logo
Welcome Guest! To enable all features please Login or Register.

Notification

Icon
Error

Options
Go to last post Go to first unread
fcarbajal  
#1 Posted : 8 years ago
fcarbajal

Rank: Newbie

Groups: Registered
Joined: 3/3/2017(UTC)
Posts: 5
Man
Spain

Thanks: 2 times
Im trying to split a document and i'm getting an "unexpected error code" in ImportPages method.

This is my code:

Code:

            foreach (KeyValuePair<PdfDocument, List<String>> documentSplitInfo in documentsSplitInfo)
            {
                PdfDocument document = documentSplitInfo.Key;

                foreach (String splitInfo in documentSplitInfo.Value)
                {
                    try
                    {
                        PdfDocument newDocument = PdfDocument.CreateNew();

                        newDocument.Pages.ImportPages(document, splitInfo, 0);

                        String newPath = Path.Combine(Util.GetNeodocOutloocAddinTempForlder(), document.Title);
                        newDocument.Save(newPath, Patagames.Pdf.Enums.SaveFlags.Incremental);
                    }
                    catch (System.Exception ex)
                    {
                        Logging.LogUtils.WriteLog(Logging.LogLevel.ERROR, ex);
                    }
                }

            }


document is a PdfDocument, not null
splitInfo is a String with the pages to split.

Exception Info:

Code:
2017-03-06 13:27:23 [ERROR] - Excepción
Mensaje: Unexpected error code.
Exception: 
System.Exception ProcessLastError()
Data: 
StackTrace:
   at Patagames.Pdf.Pdfium.ProcessLastError()
   at Patagames.Pdf.Net.PdfPageCollection.ImportPages(PdfDocument sourceDoc, String pagerange, Int32 index)


Any idea that what´s happening?

Thanks.

Edited by user 8 years ago  | Reason: Not specified

Paul Rayman  
#2 Posted : 8 years ago
Paul Rayman

Rank: Administration

Groups: Administrators
Joined: 1/5/2016(UTC)
Posts: 1,116

Thanks: 8 times
Was thanked: 130 time(s) in 127 post(s)
Do you see that http://forum.patagames.c...merge-multiple-pdf-files
Try to use "1" instead "0" at the last parameter of ImportPages method.
thanks 1 user thanked Paul Rayman for this useful post.
fcarbajal on 3/9/2017(UTC)
Users browsing this topic
Guest
Forum Jump  
You cannot post new topics in this forum.
You cannot reply to topics in this forum.
You cannot delete your posts in this forum.
You cannot edit your posts in this forum.
You cannot create polls in this forum.
You cannot vote in polls in this forum.