Developer Tools
|
Office Productivity Applications
|
Platform-Agnostic APIs
|
Home | Online Demos | Downloads | Buy Now | Support | About Us | News | Working Together | Contact Us
One of the big reasons for creating PDF documents is to put them online. When you do this, you may want to link to a particular page in the document. In other words, you want to refer to information that is on a particular page on the PDF document - you do not want to refer to the whole document or provide additional instructions on the page where the required information is.
The usual way to do this is to use a page
parameter in the hyperlink that links to the document. For example:
<a href="http://www.example.com/sample_doc.pdf?page=3">Page 3 in sample_doc.pdf</a>
Now, support for the page
parameter is far from perfect and not universal. If the URL is launched by an OS shell program, it may truncate the parameters. The browser or the PDF plugin may do this. Even if the page parameter manages to survive, the PDF viewer application may not support it.
One alternative is to bypass the page parameter completely. You could instead rely on support for "PDF actions" in the PDF viewer applications, which is more reliable. You could add a PDF action to the first page of the PDF document so that the viewer application (such as Adobe Reader) will automatically jump to the required page instead of the usual page 1.
Here is how you do it using PDFOne (for Java).
import java.io.IOException; import com.gnostice.pdfone.PdfAction; import com.gnostice.pdfone.PDFOne; import com.gnostice.pdfone.PdfDocument; import com.gnostice.pdfone.PdfException; public class Auto_Skip_To_Page_In_PDF { public static void main(String[] args) throws IOException, PdfException { // Load an existing document PdfDocument doc = new PdfDocument(); doc.load("sample_doc.pdf"); // Add a go-to PDF action - this action is executed // by viewer applications when they open the document doc.addAction(PdfAction.GOTO, 3); // Save the modified document to file doc.save("sample_doc2.pdf"); // Clean up doc.close(); } }
Here is a sample PDF document that was modified using this code. You can download it and test it. When viewed inside Adobe Reader, page 3 will be displayed by default instead of the usual page 1.
---o0O0o---
Our .NET Developer Tools | |
---|---|
Gnostice Document Studio .NETMulti-format document-processing component suite for .NET developers. |
PDFOne .NETA .NET PDF component suite to create, edit, view, print, reorganize, encrypt, annotate, and bookmark PDF documents in .NET applications. |
Our Delphi/C++Builder developer tools | |
---|---|
Gnostice Document Studio DelphiMulti-format document-processing component suite for Delphi/C++Builder developers, covering both VCL and FireMonkey platforms. |
eDocEngine VCLA Delphi/C++Builder component suite for creating documents in over 20 formats and also export reports from popular Delphi reporting tools. |
PDFtoolkit VCLA Delphi/C++Builder component suite to edit, enhance, view, print, merge, split, encrypt, annotate, and bookmark PDF documents. |
Our Java developer tools | |
---|---|
Gnostice Document Studio JavaMulti-format document-processing component suite for Java developers. |
PDFOne (for Java)A Java PDF component suite to create, edit, view, print, reorganize, encrypt, annotate, bookmark PDF documents in Java applications. |
Our Platform-Agnostic Cloud and On-Premises APIs | |
---|---|
StarDocsCloud-hosted and On-Premises REST-based document-processing and document-viewing APIs |
Privacy | Legal | Feedback | Newsletter | Blog | Resellers | © 2002-2024 Gnostice Information Technologies Private Limited. All rights reserved. |