PDFsharp & MigraDoc Foundation

PDFsharp - A .NET library for processing PDF & MigraDoc Foundation - Creating documents on the fly
It is currently Fri Nov 08, 2024 10:58 pm

All times are UTC


Forum rules


Please read this before posting on this forum: Forum Rules



Post new topic Reply to topic  [ 5 posts ] 
Author Message
PostPosted: Fri May 17, 2024 2:38 pm 
Offline

Joined: Fri May 17, 2024 2:28 pm
Posts: 2
The attached pdf is created by PDFSharp:

string source = filepath_mage;
string destinaton = filepath_pdf;
using ( PdfDocument doc = new PdfDocument() )
{
XImage img = XImage.FromFile(source);
PdfPage nxpage = new PdfPage();
doc.Pages.Add(nxpage);
XGraphics xgr = XGraphics.FromPdfPage(nxpage);
XRect srcRect = new XRect(0,0,img.PixelWidth,img.PixelHeight);
XRect dstRect = new XRect(0,0,nxpage.Width.Value,nxpage.Height.Value);
xgr.DrawImage(img,dstRect,srcRect,XGraphicsUnit.Point);
using ( Stream nxream = File.Open ( destinaton, FileMode.Create ) )
{
doc.Save(nxream);
}
}


It cannot be read by PDFSharp:

PdfDocument inputDocument = PdfReader.Open(file,PdfDocumentOpenMode.Import);

Exception: PdfSharp.Pdf.IO.ObjectNotAvailableException: 'Cannot retrieve stream length.
PDFsharp cannot read this PDF file. If you think your file is a valid PDF file please send it to us so that we can fix this bug in the PDF parser.'


Top
 Profile  
Reply with quote  
PostPosted: Sat May 18, 2024 5:25 pm 
Offline
PDFsharp Expert
User avatar

Joined: Wed Dec 09, 2009 8:59 am
Posts: 346
See also:
http://forum.pdfsharp.net/viewtopic.php?f=2&t=832

_________________
Öhmesh Volta ("() => true")
PDFsharp Team Holiday Substitute


Top
 Profile  
Reply with quote  
PostPosted: Sun May 19, 2024 9:27 am 
Offline
PDFsharp Guru
User avatar

Joined: Sat Mar 14, 2015 10:15 am
Posts: 1007
Location: CCAA
See also:
https://docs.pdfsharp.net/General/Issue-Reporting.html

_________________
Best regards
Thomas
(Freelance Software Developer with several years of MigraDoc/PDFsharp experience)


Top
 Profile  
Reply with quote  
PostPosted: Mon May 20, 2024 7:46 am 
Offline

Joined: Fri May 17, 2024 2:28 pm
Posts: 2
sent project as required
PDFsharp.IssueSubmissionTemplate-master-fm


Top
 Profile  
Reply with quote  
PostPosted: Tue May 21, 2024 11:50 am 
Offline
PDFsharp Guru
User avatar

Joined: Mon Oct 16, 2006 8:16 am
Posts: 3111
Location: Cologne, Germany
Thanks.
I don't know where you sent it.
Consider uploading it to GitHub.
https://github.com/empira/PDFsharp/issues

_________________
Regards
Thomas Hoevel
PDFsharp Team


Top
 Profile  
Reply with quote  
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 5 posts ] 

All times are UTC


Who is online

Users browsing this forum: Bing [Bot] and 21 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
Privacy Policy, Data Protection Declaration, Impressum
Powered by phpBB® Forum Software © phpBB Group