PDFsharp & MigraDoc Foundation
http://forum.pdfsharp.de/

cannot open pdf created by pdfsharp
http://forum.pdfsharp.de/viewtopic.php?f=2&t=4594
Page 1 of 1

Author:  fishman-misha [ Fri May 17, 2024 2:38 pm ]
Post subject:  cannot open pdf created by pdfsharp

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.'

Author:  () => true [ Sat May 18, 2024 5:25 pm ]
Post subject:  Re: cannot open pdf created by pdfsharp

See also:
http://forum.pdfsharp.net/viewtopic.php?f=2&t=832

Author:  TH-Soft [ Sun May 19, 2024 9:27 am ]
Post subject:  Re: cannot open pdf created by pdfsharp

See also:
https://docs.pdfsharp.net/General/Issue-Reporting.html

Author:  fishman-misha [ Mon May 20, 2024 7:46 am ]
Post subject:  Re: cannot open pdf created by pdfsharp

sent project as required
PDFsharp.IssueSubmissionTemplate-master-fm

Author:  Thomas Hoevel [ Tue May 21, 2024 11:50 am ]
Post subject:  Re: cannot open pdf created by pdfsharp

Thanks.
I don't know where you sent it.
Consider uploading it to GitHub.
https://github.com/empira/PDFsharp/issues

Page 1 of 1 All times are UTC
Powered by phpBB® Forum Software © phpBB Group
https://www.phpbb.com/