Spire.PDF is a professional PDF library applied to creating, writing, editing, handling and reading PDF files without any external dependencies. Get free and professional technical support for Spire.PDF for .NET, Java, Android, C++, Python.

Tue Aug 08, 2017 3:25 pm

I have a program which prints PDF documents on 2 pages per sheet using the PdfDocument.createBooklet() method. However, when I convert some PDFs to a booklet the bottom of each page shows a box of information that was not in the original PDF. Could you please explain to me what this box is and how to remove it or stop it from appearing?
I have managed to prevent this from happening by converting to XPS format and then back to PDF, however this is resource intensive and prone to errors.
This is the bottom of the original PDF:
Image

This is the box of information that appears at the bottom of the PDF after creating a booklet:
Image

milltownham
 
Posts: 29
Joined: Wed Aug 02, 2017 2:52 pm

Wed Aug 09, 2017 2:35 am

Hello Thomas,

Thanks for your inquiry.
Would you please share your sample pdf and the code so we can look into it?

Sincerely,
Jane
E-iceblue support team
User avatar

Jane.Bai
 
Posts: 1156
Joined: Tue Nov 29, 2016 1:47 am

Wed Aug 09, 2017 10:15 am

Here is my sample code:
Code: Select all
  PdfDocument doc = new PdfDocument();

            doc.LoadFromFile(filePath);           

            int pdfNumOfPages = doc.Pages.Count;

            //if total pages is odd, add one blank at the end
            if (pdfNumOfPages % 2 == 1)
            {
                doc.Pages.Add();

                doc.SaveToFile("C:\\Users\\tomih\\Documents\\PIL_Printer\\Temp.pdf");
                //I don't know why I have to do this but doc is null if I don't reload the file
                doc.LoadFromFile("C:\\Users\\tomih\\Documents\\PIL_Printer\\Temp.pdf");
                //new loaded doc file has extra blank page at end if originally odd number of pages
            }

            //number of pages of new document (always has even number of pages)
            pdfNumOfPages = doc.Pages.Count;

            //array the size of number of pages
            int[] newPageOrder = new int[pdfNumOfPages];

            //integers and while loop produce array with correct order of pages for rearranging pdf file before creating booklet
            int start = 0;
            int end = pdfNumOfPages - 1;
            int i = 0;
           
            while (i < pdfNumOfPages)
            {
                newPageOrder[start] = i;
                start++;
                i++;
                if (i >= newPageOrder.Length)
                    break;
                newPageOrder[end] = i;
                end--;
                i++;
            }

            //again, doc is null if I don't reload from file
            doc.SaveToFile("C:\\Users\\tomih\\Documents\\PIL_Printer\\Temp.pdf");
            doc.LoadFromFile("C:\\Users\\tomih\\Documents\\PIL_Printer\\Temp.pdf");

            //applies new order to pdf pages using array produced earlier
            doc.Pages.ReArrange(newPageOrder);

            doc.SaveToFile("C:\\Users\\tomih\\Documents\\PIL_Printer\\Temp.pdf");

            //creates the booklet we have been preparing for incorporating scale factors calculated above and "false" means non double sided booklet printing
            doc.CreateBooklet("C:\\Users\\tomih\\Documents\\PIL_Printer\\Temp.pdf", PdfPageSize.A4.Width * 2, PdfPageSize.A4.Height, false);

            doc.SaveToFile("C:\\Users\\tomih\\Documents\\PIL_Printer\\Test.pdf");


I also seem to be having problems with nullReferenceException errors for PdfDocument "doc" which appears to be null after each time it is used, causing me to have to save and reload it from a file (see comments in code). Could you have a look at that for me also?

Thanks

milltownham
 
Posts: 29
Joined: Wed Aug 02, 2017 2:52 pm

Wed Aug 09, 2017 10:28 am

Hello,

I will look into it and reply you tomorrow.

Sincerely,
Jane
E-iceblue support team
User avatar

Jane.Bai
 
Posts: 1156
Joined: Tue Nov 29, 2016 1:47 am

Thu Aug 10, 2017 3:47 am

Hello,

Sorry for the late reply.
After an initial test with the latest hotfix(Spire.PDF Pack(Hot Fix) Version:3.9.266), I can confirm that everything works well. Please use this version to have a try.
Apologize for the inconvenience caused by the free version.

Sincerely,
Jane
E-iceblue support team
User avatar

Jane.Bai
 
Posts: 1156
Joined: Tue Nov 29, 2016 1:47 am

Thu Aug 10, 2017 9:25 am

Okay so that has solved the problem of the nullReferenceException.

However, the PDF booklet appears to still include that box of information, although it is not visible, but it causes the original pages to no longer fill the whole page. How do I fix this? Is it something to do with the crop box?

Image
As you can see, the text is still there, just not visible.

Thanks

milltownham
 
Posts: 29
Joined: Wed Aug 02, 2017 2:52 pm

Thu Aug 10, 2017 10:14 am

Hello,

Thanks for your response. I have noticed the issue and posted it to our Dev team, once it is resolved, or we have some other update, we will let you know ASAP.

Sincerely,
Gary
E-iceblue support team
User avatar

Gary.zhang
 
Posts: 1380
Joined: Thu Apr 04, 2013 1:30 am

Fri Aug 11, 2017 8:52 am

Hello,

We have checked the document you provided that box of information is the content out of display area , please see the screenshot, so please adjust the size to make the original pages to fill the whole page.

Sincerely,
Gary
E-iceblue support team
User avatar

Gary.zhang
 
Posts: 1380
Joined: Thu Apr 04, 2013 1:30 am

Fri Aug 11, 2017 10:36 am

How should I do that? It only appears whenever the booklet is created, so surely adjusting the size before that would crop out bits of the PDF that I want to keep?

milltownham
 
Posts: 29
Joined: Wed Aug 02, 2017 2:52 pm

Mon Aug 14, 2017 9:59 am

Hello,

Sorry for late reply as weekend. I have posted the issue to our Dev team for investigation further, once there is update, we will let you know ASAP.

Sincerely,
Gary
E-iceblue support team
User avatar

Gary.zhang
 
Posts: 1380
Joined: Thu Apr 04, 2013 1:30 am

Thu Aug 17, 2017 12:10 pm

Hi,

Any progress on this?

milltownham
 
Posts: 29
Joined: Wed Aug 02, 2017 2:52 pm

Fri Aug 18, 2017 10:20 am

Hello,

The issue has not get resolved yet, once there is new update, we will let you know immediately.

Sincerely,
Gary
E-iceblue support team
User avatar

Gary.zhang
 
Posts: 1380
Joined: Thu Apr 04, 2013 1:30 am

Tue Sep 05, 2017 9:39 pm

It has been 3 weeks now since the dev team started working on this problem. Have they figured it out yet?

milltownham
 
Posts: 29
Joined: Wed Aug 02, 2017 2:52 pm

Wed Sep 06, 2017 3:51 am

Hello,

Sorry that the issue is still not resolved yet, once there is any new update, we will let you know ASAP.

Sincerely,
Gary
E-iceblue support team
User avatar

Gary.zhang
 
Posts: 1380
Joined: Thu Apr 04, 2013 1:30 am

Tue Sep 26, 2017 3:12 am

Hello milltownham,

Glad to inform that the issue has been resolved and the hotfix is available now. Please download the Spire.PDF Pack(Hot Fix) Version:3.9.360 to have a check.

Sincerely,
Jane
E-iceblue support team
User avatar

Jane.Bai
 
Posts: 1156
Joined: Tue Nov 29, 2016 1:47 am

Return to Spire.PDF