PDFsharp & MigraDoc Foundation

PDFsharp - A .NET library for processing PDF & MigraDoc Foundation - Creating documents on the fly
It is currently Thu Mar 28, 2024 5:25 pm

All times are UTC


Forum rules


Please read this before posting on this forum: Forum Rules



Post new topic Reply to topic  [ 3 posts ] 
Author Message
PostPosted: Fri Feb 21, 2020 9:21 am 
Offline

Joined: Fri Feb 21, 2020 8:44 am
Posts: 2
Ich habe den sample Code von PDFsharp verwendet, um meine PDF-Dateien zu mergen. Alles hat wunderbar funktioniert. Anschließend habe ich die gemergete PDF bearbeitet und als ich diese speichern wollte gab mir Adobe folgende Meldung: Das Dokument konnte nicht gespeichert werden. Beim Lesen dieses Dokuments ist ein Problem aufgetreten (135). Diese Fehlermeldung verhindert mich die bearbeitete PDF zu speichern. Gibt es Lösungsansätze, dass solch eine Fehlermeldung nicht mehr angezeigt wird? Die PDF-Dateien sind nicht fehlerhaft bzw. diese lassen sich bei einer Bearbeitung speichern.


Top
 Profile  
Reply with quote  
PostPosted: Fri Feb 21, 2020 1:53 pm 
Offline
PDFsharp Guru
User avatar

Joined: Mon Oct 16, 2006 8:16 am
Posts: 3095
Location: Cologne, Germany
http://forum.pdfsharp.net/viewtopic.php?f=2&t=832

_________________
Regards
Thomas Hoevel
PDFsharp Team


Top
 Profile  
Reply with quote  
PostPosted: Mon Feb 24, 2020 9:00 am 
Offline

Joined: Fri Feb 21, 2020 8:44 am
Posts: 2
Ich habe das sample code von Pdfsharp und das entsprechende Nuget-Package in Visual Studio verwendet.
http://forum.pdfsharp.net/viewtopic.php?f=2&t=832 welche Info soll ich daraus entnehmen?

code:
class Program
{
static void Main(string[] args)
{
// Get some file names
string[] files = GetFiles();
// Open the output document

PdfDocument outputDocument = new PdfDocument();
// Iterate files
foreach (string file in files)

{

// Open the document to import pages from it.

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);
}
}
// Save the document...
const string filename = @"C:....";
outputDocument.Save(filename);
// ...and start a viewer.
//Process.Start(filename);
}

public static string[] GetFiles()
{
//hier umwandlung mit endpfad
DirectoryInfo di = new DirectoryInfo(@"C:...");
FileInfo[] files = di.GetFiles("*.pdf");
int i = 0;
string[] names = new string[files.Length];
foreach (var r in files)
{
names[i] = r.FullName;
i = i + 1;
}
return names;
}

}
}


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

All times are UTC


Who is online

Users browsing this forum: No registered users and 162 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