Thanks to a quick search on stackoverflow and google, I was able to find that we can directly open a PDF file from a URL at a certain point.
As explained below, we can do so using the "nameddest" parameter:
How can I programmaticly open a pdf at a certain point?
However, all the links I read talk about opening the pdf file from a URL. What if I want to open the pdf file in my local file system at a given location. For example, instead of the following:
http://example.org/doc.pdf#nameddest=Chapter6
say, I want to do this:
file:///D:/work/doc.pdf#nameddest=Chapter6
I tried the same, but it doesn't work. Any help/suggestions?
Regards,
Kapil
I don't have a solution for you using the file protocol but you can achieve it by invoking Acrobat or Adobe Reader directly:
acrobat.exe /a "page=2" "c:\Binder1.pdf"
acrord32.exe /a "page=2" "c:\Binder1.pdf"
Related
I want to add a link to some text within a PDF that will bring up another PDF that is located in the same folder. I wish to use relative addressing so that the PDF suite is transportable to other users and computers. I wish this to work on Linux and Macs.
LibreOffice Draw, despite promises, writes out the link address as a full path. Thus if taken to another computer with another user the link fails to work.
I tried manually editing the PDF files using vi and altered the link syntax so;
<</Type/Annot/Subtype/Link/Border[0 0 0]/Rect[940.9 480.3 1200.7 507.9]/A<</Type/Action/S/URI/URI(Content/Information.pdf)>>
where the target file, "Information.pdf" is in a subdirectory "Contents".
On Linux using Document Viewer, it works! On an Apple, Preview (a PDF viewer) interprets the target file needs to be opened by some application. Adobe Reader doesn't like this syntax either. I tried prefixing the filename with the keyword "file:" which works for a full path but not with relative addressing.
Does anyone know what syntax might work for me
Editing a PDF you can select text and add a hyperlink using LibreOffice Draw. It is then possible to edit the PDF file with a text editor such as vi.
To find the line with the link search for the filename of the target. One problem is that LibreOffice insists in using a fully qualified domain name to locate the file and this won't work after the file is moved, say to another computer. The unedited line should be similar to;
<</Type/Annot/Subtype/Link/Border[0 0 0]/Rect[940.9 480.3 1200.7 507.9]/A<</Type/Action/S/URI/URI(File:<fullpathname>/Content/Information.pdf)>>
Where Content/Information.pdf is the link target in the same directory as the linking pdf. This line should be changed to
<</Type/Annot/Subtype/Link/Border[0 0 0]/Rect[940.9 480.3 1200.7 507.9]/A<</Type/Action/S /Launch/F(Content/Information.pdf)>>
This works on Unix and MacOs
My site draws a column chart. I have a button to save it as a PDF file showing it before saving.
The way it works now is this.
google.visualization draws the chart.
html2canvas takes a screenshot of the chart.
jsPDF inserts the screenshot in a PDF file and shows it to the user.
The problem is the name of the PDF file. It is something like 5d78c1eb-0829-4e7e-8ffc-71cf1f102f56.pdf and the url is blob:http://example.com/5d78c1eb-0829-4e7e-8ffc-71cf1f102f56
When user sees the PDF and clicks save he receives this awful file name.
Now I show the PDF this way:
window.open(doc.output('bloburl'), '_blank');
I can set desired file name if I change this line to this:
doc.save('sample-file.pdf');
But in such a case the file just downloads but I need to show it first.
Is there a way to show the PDF and give it a desirable name? I tried this:
window.open(doc.output('bloburl', {filename: 'myFileName.pdf'}), '_blank');
But it did not help.
Another way I see is not showing the PDF from jsPDF, but sending images to the server and making a PDF file there using TCPDF. The files made with TCPDF can have a name I give it, but I think it is dumb to send the images there and back.
So the question is how can I make a PDF and show it to the user with the name I want?
At the moment the answer is no. You can download it directly, as mentioned in the accepted answer of this question: Download with filename
But you create an objectUrl and therefore the filename is always the url.
Maybe you could create an browser-extension for this...but I haven't had the time to try yet. Furthermore, you can't expect your visitors to have the extension installed.
I have successfully managed to download the PDF file from a site that uses PDF.js to create and show PDFs (using selenium)
The downloaded PDF file does not open on my desktop (mac & linux).
It seems like the PDF is encoded, or encrypted.
On closer inspection, right after the PDF is downloaded, the network tab also shows pdf.js.worker. It seems like pdf.js.worker is decoding this file to show on the site.
How can I replicate, or follow the same flow of pdf.js.worker and decode this PDF?
Update
I have tried looking at the pdf.js.worker code to follow the code execution, but it seems like a really hard task, hoping there is a simpler way.
i have a task about .PDF files that pdf file should open in browser with custom zoom level of 125% or 150%, i tried many times, but it is not working properly in firefox, as it implements zoom on PDF file but it switch on page#2, i study the adobe's given parameters for PDF file and tried to use them as following in href,
"SICS-47.pdf?page=1&zoom=125,0,0"
"SICS-47.pdf#page=1&zoom=125,0,0"
but no success, anyone here can help me please ?
thank you so much in advance.
The adobe partner reference states on page 5 that this is for IE and Netscape. I'm not sure how old this document is, but you might want to check the Firefox support for this functionality as it could be incomplete.
Reference: Adobe Partner
Another thing you could do is modify the PDF content to make sure the document opens properly. Depending on which tool you're using you could use a free library like the Perl API2 library or a paid tool like the Java iText library. Maybe there are command line tools out there that do the same, but I'm not aware of them.
I'm creating PDFs using Texmaker. I would like to create some of the PDF files so that when I give the PDF to others, they are not able to print the file or to copy the text. I know I can do this with some PDF creator applications, but can I do that from some command like program I have with Latex, MikTex and TexMaker?
It wouldn't be effective anyway. There are bits in the pdf format that purport to forbid the user from doing this, but they are really just suggestions that the reader application may or may not act on. There is nothing to stop a user from removing the code that inspects the bits from a free/libre PDF reader, or just to run a tool over the file to remove the restrictions.