PDFsharp & MigraDoc Forum
https://forum.pdfsharp.net/

Merging of Scans doesn't work properly
https://forum.pdfsharp.net/viewtopic.php?f=2&t=4800
Page 1 of 1

Author:  SvenBunge [ Tue Feb 25, 2025 12:45 pm ]
Post subject:  Merging of Scans doesn't work properly

We try to merge some PDFs of different sources. Some PDFs looks like they has been scanned.
The resulting PDF is broken.

Env: VB.net with .net Framework 4.8.1
PdfSharp 6.1.1 via NuGet

Source:
Code:
         Using outputDocument = New PdfDocument()
             For docCount = 0 To arListQuellpfadPdf.Count - 1
                 Using inputDocument As PdfDocument = PdfReader.Open(arListQuellpfadPdf(docCount), PdfDocumentOpenMode.Import)
                     For Each page As PdfPage In inputDocument.Pages
                         outputDocument.AddPage(page)
                     Next
                 End Using
             Next
             outputDocument.Save(zielpfadPdf)
         End Using


In the resulting PDF, the pages have a size of 0x0. We interspected the Width and Height values in the Line outputDocument.AddPage(page) and every page has Width and Height set - but they differ slightly during the different sources.

Expected
We receive a PDF file with all pages of the given files incl. all elements of the given files with the page size of the given files.

Author:  SvenBunge [ Tue Feb 25, 2025 12:49 pm ]
Post subject:  Re: Merging of Scans doesn't work properly

We try to get a scan that we're allowed to use for sharing.

Attached the file info of the source file and the same of the resulting file. (Size is for the full document)

Attachments:
File comment: Dest file info
Greenshot 2025-02-25 13.46.39.png
Greenshot 2025-02-25 13.46.39.png [ 28.81 KiB | Viewed 12746 times ]
File comment: Source File Info
Greenshot 2025-02-25 13.04.13.png
Greenshot 2025-02-25 13.04.13.png [ 33.6 KiB | Viewed 12746 times ]

Author:  Thomas Hoevel [ Thu Feb 27, 2025 11:55 am ]
Post subject:  Re: Merging of Scans doesn't work properly

There is nothing we can do without the PDF files.

If the issue persists with PDFsharp 6.2.0 Preview 3, then please make the files and the code available for investigation.

Do the problems persist when you open all PDF files in Adobe Reader and save them using "File / Save as"?
Adobe Reader can fix some anomalies of specific PDF files.

Author:  SvenBunge [ Wed Jul 23, 2025 10:58 am ]
Post subject:  Re: Merging of Scans doesn't work properly

The answer was: There where some DLLs of different versions on the path and the binding was not configured well.
This causes unpredictable results of some libraries - also PDFsharp.

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