I have a asp.net app that writes a pdf to file. Then, later that file is opened into a window (standard acrobat reader) for viewing. No problems there.
The weird part...
The entire document loads as it should, but the Reader initially shows the last page in the document on the screen. The user must then scroll up to the first page. It doesn't happen all the time (about 50%) and occurs across several test computers.
Is there a switch in the code I'm suppose to use in creating the file or displaying the file to tell the reader to "start displaying the document on the first page?"
Environment particulars:
asp.net 3.5 vb,
websupergoo's abcpdf.net pro 7 (assembly that creates the pdf file),
Windows 2008 Server,
IIS7
Thanks
Just FYI, I had this same issue and started using #page=1. However, be aware that this causes a bug in IE where after a user opens and closes 50-60 documents, Adobe Reader will stop responding. I had to take out the #page=1 bookmark parameter, and am now searching for another solution...
I had a similar problem and the #view=FitH parameter is what caused it. Removing that parameter fixed it for me. I still have no idea why.
May be helpful (client setting in reader):
http://korayem.net/post/2007/12/Adobe-Reader-Tip-Open-a-PDFs-Last-Viewed-Page.aspx
I found the answer... at least a work around.
Since I'm using a response.redirect to call the pdf in a browser window, I programmatically added "#Page=1" to the end of the filename string. It opens to the first page every time. The "#Page=n" (where "n" is the number of the page, of course) opens to the page of choice.
Learn something everyday...
Check if you can remove the 'OpenAction' name and related array value from the PDF using the above mentioned pdf library. Looks like 'OpenAction' is pointing to the last page.
PDF 32000-1:2008 - Page 74:
OpenAction - array or dictionary
(Optional; PDF 1.1) A value specifying
a destination that shall be displayed
or an action that shall be performed
when the document is opened. The value
shall be either an array defining a
destination (see 12.3.2,
"Destinations") or an action
dictionary representing an action
(12.6, "Actions"). If this entry is
absent, the document shall be opened
to the top of the first page at the
default magnification factor.
Related
I am thinking about opening a PDF file with some editable fields in the browser , by which i can modify the PDF file / fill information etc and then save that PDF FORM
Please guide me in a right direction ?
I think in your case Rad PDF can work. It is a PDF Viewer and Editor for ASP.NET by which you can open the PDF with editable fields in browser and can even modify the PDF and save it.
Check the link:- https://www.radpdf.com/demo/easy-integration/
and another one is below:-
https://code.msdn.microsoft.com/PDF-Editor-to-Edit-PDF-5fb73b8d
Hope it will work in your case.
Thanks
You cannot. Simple.
PDFs are edited by the native app, in your case may be Chrome, Safari and Internet Explorer. You do not have control on anything that happens when the user edits the PDF in a native app context.
Pdf documents come in many flavors (standards). One of them (FDF) matches your usecase very closely. This particular standard allows you to edit a pdf form, on completion (or some other event) it would send the data back to a server, collect a response, and modify the pdf with the incoming data.
Keep in mind though that this standard is not often used. There may be a good reason for that (not a lot of libraries support it).
I am trying to render a PDF via servlet,using Itext for getting PDF file.
Need to disable save ,print option in adobe pdf reader menu bar while other options like scroll,find should be there and in addition need to disable the file menu of the browser window in which it is rendered.
I have disabled print and file menu using below code
stamper.setEncryption(null,null,
PdfWriter.HideWindowUI, PdfWriter.STRENGTH40BITS);
stamper.setViewerPreferences(PdfWriter.HideToolbar);
Problem is
disable save button in Adobe PDF reader menu bar (using **Adobe Reader 9**).
We need to distinguish two different aspects: printing and saving.
You can encrypt a file and set the permissions in such a way that printing isn't allowed. However: if you only encrypt a document with an owner password, it is very easy to decrypt the document and to remove the restrictions. Encrypting a document with an owner password only works on a psychological level: for instance: you indicate that the original producer of the document doesn't want the document to be printed.
If you want to avoid that an end users saves a PDF document, you are asking something that is impossible. The only way to avoid that an end user doesn't have a copy of the PDF is by not sending him the PDF. A PDF can't be opened in Adobe Reader without having the actual bytes on the disk. Even if you would disable saving (for instance in the context of a web application), you'd always find the PDF somewhere in the temp files and people would be able to copy that file as many times as they want.
In your code snippet, you try hiding the toolbar (a viewer preference), but that doesn't make sense. Whether or not this viewer preference will be respected entirely depends on the PDF viewer. For instance: in Adobe Reader X and later, you have a special widget that appears when you hover over the document. This widget allows users to save the document.
Even with Adobe Reader 9, hiding the toolbar isn't sufficient: if the user chooses the appropriate menu item or hits the appropriate "hot key", the toolbar would appear and they could happily click the Save button. In addition, they could have right-clicked and chosen "Save" as well.
In short, you're asking the wrong question.
What you need to do is NOT prevent saving BUT control the actual use of the PDF and that's where DRM (Digital Rights Management) comes in. DRM however is usually very expensive, it requires a custom PDF viewer and it's out of the scope of iText.
I'm trying to open a PDF document from a hyperlink to a certain page. So I set the link to this: http://www.mywebsite.com/document.pdf#Page=14
However, when I click the link initally that's the url I see in the urlbar, but it eventually goes to just: http://www.mywebsite.com/document.pdf
I can type the #Page=14 to the end and press enter and it will work but for some reason it will not work the first way.
What am I doing wrong or what might be preventing me from opening to the correct page? Thanks!
I'm a little confused by this syntax. The bookmark in a URL will be the name of an anchor tag. Something like #topic1, #topic2. What is the purpose of having a name/value pair as your bookmark?
It should work according to Adobe.
Unless you are using Acrobat 7.0 in Internet Explorer. There was a bug with that combination. Solution: upgrade to Acrobat Reader 8, or use a different browser.
With our CUIT tests in Visual Studio we have the problem that we cannot record the Browser Button action in IE. We just get:
C:\fakepath\Document1.txt
But this obviously does not lead to the real document in a playback. And it's not possible to just type the path into the Browse text field anymore.
Just FYI: This applies to the Coded UI Testing Framework in Visual Studio 2010 Feature Pack 2. The recorder only works with IE.
Any ideas?
Not being able to access the file upload control is supposed to be a security feature. I guess you need to step out of your environment and into the windows environment to accomplish anything.
If you use a macro recorder that can playback from command line (like http://www.jitbit.com/macro-recorder/versionhistory/) or a similar means, you may be able to record the missing step here (like a simple tab key hit - provided you have focused on the control before the upload control -, a typed text, and another tab key hit) and start the resulting "batch". Or you can even record a mouse click.
However, if this test runs in other browsers (if I understand you correctly), wouldn't it be safe enough to assume that it runs in IE as well, because after all you are using a standard control?
Actually, turns out I can edit the value "C:\fakepath\Document1.txt" manually in the uitest UIMaps file and change it to a real path. And it works in the reply like this.
I've seen many articles about dragging files INTO a browser, but none about dragging files FROM the browser to a windows application or the desktop/windows-explorer.
I'm looking for a cross-browser solution but IE8 is our main browser.
If I create a link in a web page and then drag that link from the page into Microsoft Word, it inserts a link. However, if that link is pointing at a PDF document, I would like it to embed the PDF doc inside the Word doc, as if I'd dragged it from Windows Explorer, into MS Word.
Is that possible?
I've even tried pointing the link at an ASP page which returns "application/pdf" data but I still just get a link in my word doc so I suspect that links are the wrong way to go.
Thanks for any help!
I suspect you'll find that it is indeed not possible. The behavior upon drop is determined by the "receiving" application, not the "sending" application. As you point out, Word creates links to things that are dropped on it. The browser doesn't have any control over that.
I noticed that you can actually drag a HYPERLINK from a browser and drop in into a folder. After that a file there is created with .URL extension that contains the actual link.
So it is possible develop a program that will be able to accept that hyperlinks (as the usual windows folder does) and after it accepts the hyperlink file, it will automatically download the actual file from internet (by the hyperlink from the hyperlink file).
So the process will be:
drag-n-drop a hyperlink to the app
app recognizes the link
app automatically downloads the appropriate file and stores it somewhere.