We're sorry Aspose doesn't work properply without JavaScript enabled.

Free Support Forum - aspose.com

Could We Find a Specific Page in a Pdf File Using Aspose.Pdf.Kit?

Hello,


We got a requirement from our client that when
doing two-sided print pdf file, some specific pages should be at the
front page, for example, the cover of appendix. So I want to know if
there exists an approach to achieve this goal.I suppose such an
approach: place some specific text in the pages of Word, convert it to
Pdf, search these text and get the Page number, then make decision
according to the number: if the number is odd,skip, otherwise,insert a
blank page before this page. Does Aspose.Pdf.Kit support it or provide
any methods to achieve it? Thanks.

Hi Sheng,

Please find the answer to your questions below:

Yesheng:

I suppose such an approach: place some specific text in the pages of Word, convert it to Pdf,


You can use Aspose.Words for .NET in order to create Word documents and then convert them to PDF.

Yesheng:

search these text and get the Page number, then make decision according to the number:


Aspose.Pdf for .NET allows you to search particular text and returns the related information. You may also keep track of the related pages at your end. For example, when you loop through the pages and search text in each page, you can keep record of the page number in which you find the text.

Yesheng:

if the number is odd,skip, otherwise,insert a blank page before this page.


You may insert an empty page at a particular location (page number) in the PDF file.

Yesheng:
We got a requirement from our client that when doing two-sided print pdf file, some specific pages should be at the front page, for example, the cover of appendix.


You can also send a whole PDF to printer using Aspose.Pdf for .NET. Also, as I shared the details in reply to your other questions, you can organize the pages in the PDF before sending it to the printer. However, when the PDF is sent to the printer, it is sent as a whole and all the pages are printed in a sequence.

I hope this helps. If you find any further questions, please do let us know.
Regards,

Thank you for your reply. Yesterday I came up with an approach that using Word Section break (Odd/Even page) to add extra blank page by Word itself, then convert it to pdf by Aspose.Pdf.Kit. But unfortunately, the result of Word looked fine, but after calling PdfFileEditor.Concatenate method to concatenate other pdf files, the extra blank pages added automatically by Word were removed :( So could we reserve those extra blank pages during concatenating? Thanks.

Hi Sheng,

Thanks for sharing the details.

As far as I have understood, you have been able to create word documents, able to insert blank pages using Word section break approach and convert these word files into PDF format. However when you concatenated the resultant PDF documents, the final merged document did not include the blank pages ? If so is the case, can you please share some sample PDF documents (with blank pages) so that we can test the scenario at our end. We apologize for your inconvenience.

However concerning to your query "So could we reserve those extra blank pages during concatenating? " Can you please share some details regarding this requirement.

Hi,
I uploaded two files: the Word documents has 43 pages totally, including several blank pages before every cover of Appendix (A1,A2,A3,A4 and A5). These blank pages were added by Word automatically after I set section break (even page) before those appendix covers. And during converting and merging, I inserted a two-page pdf file into the uploaded pdf file. You can see the landscope pages in it. But in the pdf, there are only 40 pages and those blank pages in Word are removed. And I also found a strange thing: during debugging, I called document.PageCount property to see the page count of Word Document, I saw the number was 42, but it should be 43…

Additionally, I converted that 43 pages Word doc to pdf during debugging, and saved it in a temp folder:
Document doc = new Document(ByteArrayName);
doc.save(“d:\ABC.pdf”);

Because doc.PageCount I got was 42, in the generated pdf only had 42 pages. The blank page before A1 cover is missing. It’s strange.

Hi,

I have solved this problem now. Thanks.

Hi Sheng,

Thanks for using our products.

I am glad to hear that your problem is fixed. In case you still face any problem or you have any further query, please feel free to contact.