PDFsharp & MigraDoc Foundation

PDFsharp - A .NET library for processing PDF & MigraDoc Foundation - Creating documents on the fly
It is currently Mon Dec 09, 2024 11:31 pm

All times are UTC


Forum rules


Please read this before posting on this forum: Forum Rules



Post new topic Reply to topic  [ 1 post ] 
Author Message
PostPosted: Thu Apr 06, 2023 2:25 pm 
Offline

Joined: Tue Dec 06, 2022 4:04 pm
Posts: 5
Hi,

Using version "1.51.5185.0" of PDFSharp.

I've got a PDF file that was generated from Excel 365 that has fields to enter in it. It won't merge with other PDFs and has error: "The PDF document is protected with an encryption not supported by PDFsharp".

I was able to merge it using the latest release of "PDFsharp 6.0.0-preview-1 for .NET 6" however there was regression since some other files that would work before using version "1.51.5185.0" stopped working.

The error happens at the "PdfDocument inputDocument = PdfReader.Open(file, PdfDocumentOpenMode.Import);" statement.

Would like to attach files here but they're too big. Who should I send them to for support?

Here's the file that will NOT work in "1.51.5185.0" but works in "PDFsharp 6.0.0-preview-1 for .NET 6": INDP114_DATASHEET.PDF

Here are 2 files that works in version "1.51.5185.0" but NOT in the latest version: 5REG_DATASHEET.pdf, LUMBER_DIM_FT_DATASHEET.pdf

Here's the code in C# for my console app:

files = inputFiles.Split(',');

// Open the output document
PdfDocument outputDocument = new PdfDocument();

// Iterate files
foreach (string file in files)
{
if (System.IO.File.Exists(file))
{
// Open the document to import pages from it.
try {
PdfDocument inputDocument = PdfReader.Open(file, PdfDocumentOpenMode.Import);

// Iterate pages
int count = inputDocument.PageCount;
for (int idx = 0; idx < count; idx++)
{
// Get the page from the external document...
PdfPage page = inputDocument.Pages[idx];
// ...and add it to the output document.
outputDocument.AddPage(page);
}
}
catch (Exception e)
{
Console.WriteLine(e.Message + file.ToString());

}
}
}

// Save the document...
outputDocument.Save(outputFile);


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

All times are UTC


Who is online

Users browsing this forum: Baidu [Spider], Google [Bot] and 30 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