• Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
    Dedicated community for Japanese speakers
  • 한국 커뮤니티
    Dedicated community for Korean speakers
Exit
0

How do you control the PDF properties?

Participant ,
Jun 28, 2012 Jun 28, 2012

Copy link to clipboard

Copied

I am creating a batch PDF processing script. The purpose is to generate PDFs from multiple books. Part of the script is supposed to set the PDF Setup options, such as whether to expand out the bookmarks and the default zoom level. However, I found that none of those settings are carried over into the PS file from which distiller generates the PDF.

For example, here's some code that's supposed to set the expanded bookmark level to none:

var Book = app.ActiveBook;
if (Book.ObjectValid())
{
    Book.PDFBookmarksOpenLevel=Constants.FV_PDFBookmarksOpenNoneLevel;
    Book.PrintFileName="C:\\Users\\jlorenz1\\Desktop\\PS_files\\in\\book.ps";
    Book.PrintToFile=true;
    Book.SilentPrintDoc();
    }

However, when I generate the PDF from distiller, the bookmarks are still expanded out. I have also tried to set the PDF's default zoom level without any success.

Has anyone had any success setting the PDF setup options from extendscript? If so, how did you do it?

Thanks,

Joe

TOPICS
Scripting

Views

1.9K

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Participant ,
Jul 02, 2012 Jul 02, 2012

Copy link to clipboard

Copied

With some extremely helpful pointers from Rick Quatro, I believe I have more or less figured out how this has to be done. The script would need to do this:  1. in the FM book, save each file to MIF. 2. add/modify MIF statements in the file. 3. save the file back to the FrameMaker format.  For example, I have it figured out for the default PDF zoom level at least. I had to review the mif reference guide (could only find it for FM 8, any later guide out there?) and map that to the mif statements for FM 10 documents. They are similar to FM 8, but also slightly different. There's the following MIF document statements:               

  • <DPDFFit None>
  • <DPDFZoom  125.0%>

In each document in the book, I need to set the above MIF statements. Then, the FM book will print the document to PDF, where the default zoom level is 125%.  A big thanks to Rick on this one.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Jul 02, 2012 Jul 02, 2012

Copy link to clipboard

Copied

Hi Joe,

Actually, you may be able to set these properties directly without using MIF. The FrameScript versions are:

Set oBook.PDFZoomType = PDFZoomNone;

Set oBook.PDFZoomFactor = 1.25;

where oBook is your book object. These properties can be set at the document level as well. The ExtendScript equivalents are:

book.PDFZoomType = Constants.FV_PDFZoomNone;

book.PDFZoomFactor = 1.25;

I am not sure if 1.25 will work with ExtendScript. You may have to figure out how to coerce the number into the correct metric value.

As far as saving to MIF, it is the .book file itself that has to be saved to MIF in order to set the correct bookmark levels for the paragraphs in the book. That is what the other thread referred to.

I hope this helps.

Rick

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Participant ,
Jul 02, 2012 Jul 02, 2012

Copy link to clipboard

Copied

LATEST

Hi Rick,

I cannot seem update the zoom level no matter what I do. Here's what I tried:

   var Book = app.ActiveBook;

    if (Book.ObjectValid())

    {

        Book.PrintFileName="C:\\Users\\jlorenz1\\Desktop\\PS_files\\in\\book.ps";

        Book.PDFZoomType=Constants.FV_PDFZoomNone;

        $.writeln('zoom factor before: '+ Book.PDFZoomFactor)

        Book.PDFZoomFactor=125;

        $.writeln(FA_errno)

        $.writeln('zoom factor after: '+ Book.PDFZoomFactor)

        Book.PrintToFile=true;

        Book.SilentPrintDoc();

        }

According to the extendscript guide:

     When the PDFZoomType property is set to Constants.FV_PDFZoomNone (0), the PDFZoomFactor property denotes the zoom percentage of the PDF document (metric 25% to 1600%).

It also says the data type of the property is an integer. Here is the the default value: 81920. I have no idea where this number came from or what it is supposed to represent. When I attempt to set the PDF zoom factor to 125, that returns an error "number out of range". If I use a large number like 90,000, then it does update the property successfully but it doesn't change the default zoom level in the PDF. The PDF zoom level is always set to "Fit Width".

Also, do you have any idea what this opaque statement is supposed to mean: (metric 25% to 1600%).  What in the world is a metric of a percentage, which is what that seems to be saying?

Thanks,

Joe

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines