What scripting does Adobe Reader accept? - pdf

I'm trying to control some basic settings in Edit->Preferences, like zoom level and resolution. Any suggestions? Thanks.

This can be done by setting viewer preferences. See http://itextpdf.com/themes/keyword.php?id=229 for some examples.
Viewer preferences can be changed using JavaScript, but the best way is NOT to use scripting, but by setting the correct entries for the /PageLayout, /PageMode and /ViewerPreferences keys in the root dictionary of the PDF document (aka the /Catalog).
Please consult ISO-32000-1 for all the possible values of these keys. The draft of ISO-32000-1 can be downloaded for free from the Adobe website.

Related

pdfbox embedding subset font for annotations - part 2

I am creating a separate question, stemming from this one. The used code is almost the same. The reason is that the original problem was about subsetting a font with pdfbox, which I kind of dealt with. I got faced though with another problem, which is : the annotations, and how the fonts used in them are interpreted by particularly Acrobat Reader DC.
I tried different combinations of fonts and embedding options and got rather desperate. The fact is that I had a feeling that in particular the way these things are handled by the programs that interpret the PDF files is non-standard. I think I read somewhere that the annotations and the way they are displayed is on purpose non-standardized by the PDF format, to give freedom to the interpreters to handle them in their own way, since the main purpose of the annotations is the interaction with the user. TL;DR I cannot understand why Acrobat Reader DC doesn't like the annotations I have created and saved with PDFBOX. I even opened a question on friendly and helpful Adobe's User Community forum. But as I expected, someone suggested me to better investigate this question with the PDFBOX team.
Everything is possible, but rather than writing a question on PDFBOX mailing list (I could never get used or understand the efficient use of the mailing lists btw), I want to open a question here because I hope that it could help others to understand the PDF format better.
I basically rephrase the above question from the Adobe's forums here: Here is an example (Google Drive link) with FreeText annotations (but it seems to make no difference if I use Stamp annotations instead), it causes problems when open by Adobe Acrobat Reader DC (file) version 21.001.20149.37945 (I think this corresponds to April 16th '21 update). Specifically the problem happens when the Comments pane is opened by the user, either manually or automatically.
Manually:
link
Automatically:
link
While experimenting, I also tried to unset the "Use local fonts" option in Preferences -> Page Display. I had the impression that maybe Acrobat Reader will be more eager to show the error message once it is not allowed to substitute the erroneously embedded fonts with the possible local fonts. I am not sure if this is true.
The error that I get is the infamous "Cannot extract the embedded font XXXXXX+SomeFontName" as seen in the below picture:
link
The same problems happen also if I use full font embed (subsetting option set to false when using PDType0Font.load). I also tried to embed OpenSans font instead of LiberationSans, also tried to manually convert LiberationSans to a TTF font with fewer glyphs using FontForge, even tried to use Windows ARIALN.TTF, thinking that maybe the font is the problem. All cause the same behavior in Acrobat Reader DC. I have also tried to run Acrobat Reader 2019 Pro Preflight on the document and in the profile that scans the document for the possible font inconsistencies, it reports no errors.
Of course, when I use e.g. PDType1Font.HELVETICA instead of custom TTF font, I do not get the above errors. But I cannot use it because it does not contain the glyphs for the Unicode characters that I use. Does anybody have a better idea?
Thank you very much!
EDIT: to make myself clear - the error does not appear ALWAYS. it appears on some machines constantly (e.g. I am using Windows 7 64-bit with latest Acrobat Reader DC installed to reproduce it fairly well), while on my Windows 10 64-bit with the same version of Acrobat Reader DC it sometimes appears, and sometimes not - I haven't figured out why or in what cases.. - which makes me think - but no - I checked that too - the font I am using opens up alright on the machine where the problem is fairly constant)
UPDATE: at my wits ends again, I created a blank page with Apache OpenOffice, exported it to PDF, opened it with Acrobat Reader DC (last version), added a FreeTextTypewriter annotation (View -> Tools -> Comment -> Open) with 4 greek letters in ArialNarrow font, saved it, reopened it with Acrobat Reader DC, and it gives me the same error (cannot extract the embedded font...).. So this could be the Reader problem? But they made this so difficult to diagnose.. Here is the file, but I do not expect it to show errors on other machines. It's one of those moments that you start to believe in magic and the power of prayer (and a good sleep)
UPDATE 30/04/2021
So, to sum things up, I haven't come with a solution yet, but I came up with three files created with PDFBOX, OpenPDF (iText5 fork) and Acrobat Reader DC itself (can append annotations and save - just adding a simple Text box with greek text through Comment pane) - and they all issue the above error message, when open by Acrobat Reader DC. I have posted details in the Acrboat Reader forum here (same link as in comment)
I have added the code that I used to create the OpenPDF example file here and the example 3 files are in the same repository here

Edit Adobe Illustrator PDF in web browser

I am wondering if there is a way to edit pdf file (generated by Adobe Illustrator) in a web browser? They types of 'edit' that I'm after such as reposition element, changing color, changing text...etc and finally save the edited file.
iText seem like a good framework but not sure about it's capability.
Theoretically this is possible. But it would mean you would have to use a client-side PDF library capable of doing such edits. Such libraries are not common; in fact the only one I know of that could enable you to write something like this is created by PDFTron (https://www.pdftron.com).
(I know nothing more about that product; haven't used it or looked at it in detail)

PDF file custom zoom level

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.

Disable Printing in a PDF Viewer ActiveX control?

I'm using the Adobe Acrobat PDF Viewer ActiveX (AxAcroPDFLib.AxAcroPDF) control in one of my forms to display Controlled Document PDFs and my customer would like end users to not be able to print these documents. Is there anyway to disable printing through this control?
The PDF format supports permissions and "allow printing" is one of the permissions. If you can control the PDF generation of these controlled PDFs your best bet is to disable the allow print permission for users. You can also even run existing PDFs through a conversion process to add the necessary permissions with iText, ghostscript or something similar.
Besides, even if you are able to to disable the print button on the ActiveX viewer, if the user is clever enough to realize it is merely a PDF, they could just download the PDF and print it normally.
There's a new PDF software that does this by default. You would have to save the document as .wwf rather than .pdf. If the document is already in PDF format you can re-save it in WWF format.
It's provided by the World Wildlife Foundation in an effort to reduce paper use. The end user does not need to have the software installed on their computer for it to work. You can download the software for both MAC or PC from the link below. Hope this helps!
http://www.saveaswwf.com/en/

how to disable the default toolbar of pdf page

I need to provide some security of pdf page by disable the toolbar, no right click, no text selection, no cope-paste. Can anyone please tell me how to achieve this ?
I don't think you can do it. To my knowledge there is now way to programatically disable the toolbars or any of the features you are describing. And it is certainly the wrong way of providing security to a document. Maybe you should look at alternative formats.
As a general rule of thumb, if someone can see it on their computer, they can duplicate it.
It is not possible to disable the toolbar or right-click functionality in Adobe Reader (or any other reader) -- this is not a feature of the PDF specification . However, it is possible to disable content (text, images, etc) copying using a number of different PDF libraries. You can also prevent printing, page extraction, document modifications, etc.
Two PDF developer libraries that would offer you this functionality are:
Quick PDF Library
Solid Framework