Highlighted

FrameMaker 2015 - ESTK - Page Size DefaultParams

Explorer ,
Mar 21, 2017

Copy link to clipboard

Copied

Hi everybody,

I'm struggling with the page sizes when creating a PDF file from a book. I can't manage to change the sizes of the pages to DIN A4. The default parameters seems to be 210,3 x 279,4 mm.

The same issue has been discussed for FDK, but I don't get how to adapt the code:

Framemaker 2015 - FDK Client application page size issue

Here is the function I use to save PDF with the attempt to alter the page height to 297mm:

I'm glad for any help.

function SaveAsPDF(book) {

    var comp = book.FirstComponentInBook;

    while(comp.ObjectValid()) {

        var doc = SimpleOpen(comp.Name);

        doc.PDFBookmark = true;

        doc.DocAcrobatElements = false;

        doc.PDFPageHeight = 297; // here is my attempt

        comp = comp.NextBookComponentInDFSOrder;

        }

   

    var params = GetSaveDefaultParams();

    var index = GetPropIndex(params, Constants.FS_FileType);

    params[index].propVal.ival = Constants.FV_SaveFmtPdf;

    book.Save(pdfPath, params, new PropVals());

}

Hi FabianK007,

I think your accidental solution may be triggering some internal default... I don't know. It is probably not a great solution, though.

The thing about these height and width properties (among many other object properties in the object model) is that they use these "metric" units. It is a little tough to understand at first and maybe you don't really need to understand it fully. All you need is the proper conversion factor. To convert from metrics to millimeters, set the properties like this:

doc.PDFPageHeight = 297 * 185771;

doc.PDFPageWidth = 210 * 185771;

In other words, to convert from millimeters, multiply by 185771. This works in ExtendScript because the property is expressed as decimal integer. Below is an excerpt from the FDK manual that provides other conversion factors. Hope this helps some.

Russ

Using MetricT values for linear measurements

When used for linear measurement, a MetricT unit represents a point (1/72 inch). The

16 most significant bits of a MetricT value represent the digits before the decimal;

the 16 least significant bits represent the digits after the decimal. Therefore, 1 point is

expressed as hexadecimal 0x10000 or decimal 65536.

The following table lists the units of the measurement systems FrameMaker products

support and their MetricT equivalents.

TOPICS
Scripting

Views

357

Likes

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

FrameMaker 2015 - ESTK - Page Size DefaultParams

Explorer ,
Mar 21, 2017

Copy link to clipboard

Copied

Hi everybody,

I'm struggling with the page sizes when creating a PDF file from a book. I can't manage to change the sizes of the pages to DIN A4. The default parameters seems to be 210,3 x 279,4 mm.

The same issue has been discussed for FDK, but I don't get how to adapt the code:

Framemaker 2015 - FDK Client application page size issue

Here is the function I use to save PDF with the attempt to alter the page height to 297mm:

I'm glad for any help.

function SaveAsPDF(book) {

    var comp = book.FirstComponentInBook;

    while(comp.ObjectValid()) {

        var doc = SimpleOpen(comp.Name);

        doc.PDFBookmark = true;

        doc.DocAcrobatElements = false;

        doc.PDFPageHeight = 297; // here is my attempt

        comp = comp.NextBookComponentInDFSOrder;

        }

   

    var params = GetSaveDefaultParams();

    var index = GetPropIndex(params, Constants.FS_FileType);

    params[index].propVal.ival = Constants.FV_SaveFmtPdf;

    book.Save(pdfPath, params, new PropVals());

}

Hi FabianK007,

I think your accidental solution may be triggering some internal default... I don't know. It is probably not a great solution, though.

The thing about these height and width properties (among many other object properties in the object model) is that they use these "metric" units. It is a little tough to understand at first and maybe you don't really need to understand it fully. All you need is the proper conversion factor. To convert from metrics to millimeters, set the properties like this:

doc.PDFPageHeight = 297 * 185771;

doc.PDFPageWidth = 210 * 185771;

In other words, to convert from millimeters, multiply by 185771. This works in ExtendScript because the property is expressed as decimal integer. Below is an excerpt from the FDK manual that provides other conversion factors. Hope this helps some.

Russ

Using MetricT values for linear measurements

When used for linear measurement, a MetricT unit represents a point (1/72 inch). The

16 most significant bits of a MetricT value represent the digits before the decimal;

the 16 least significant bits represent the digits after the decimal. Therefore, 1 point is

expressed as hexadecimal 0x10000 or decimal 65536.

The following table lists the units of the measurement systems FrameMaker products

support and their MetricT equivalents.

TOPICS
Scripting

Views

358

Likes

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
Mar 21, 2017 0
Explorer ,
Mar 21, 2017

Copy link to clipboard

Copied

Found something, I can't call it solution because I don't know why it works.

Setting the properties to 1 OR to 10 sets the format to A4.

Beside that -not part of the workaround- I applied the changes to the book instead of its components.

function SaveAsPDF(book) {

    // to generate the pdf in din a4

    // 0 = letter ?

    // > 0 = din a4 no idea why...

   book.PDFPageHeight = 1; //same results with 10

   book.PDFPageWidth  = 1; //same results with 10

   

    var comp = book.FirstComponentInBook;

    while(comp.ObjectValid()) {

        var doc = SimpleOpen(comp.Name);

        doc.PDFBookmark = true;

        doc.DocAcrobatElements = false;

        comp = comp.NextBookComponentInDFSOrder;

    }

   

    var params = GetSaveDefaultParams();

    var index = GetPropIndex(params, Constants.FS_FileType);

    params[index].propVal.ival = Constants.FV_SaveFmtPdf;

    book.Save(pdfPath, params, new PropVals());

}

Likes

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
Reply
Loading...
Mar 21, 2017 0
Mentor ,
Mar 21, 2017

Copy link to clipboard

Copied

Hi FabianK007,

I think your accidental solution may be triggering some internal default... I don't know. It is probably not a great solution, though.

The thing about these height and width properties (among many other object properties in the object model) is that they use these "metric" units. It is a little tough to understand at first and maybe you don't really need to understand it fully. All you need is the proper conversion factor. To convert from metrics to millimeters, set the properties like this:

doc.PDFPageHeight = 297 * 185771;

doc.PDFPageWidth = 210 * 185771;

In other words, to convert from millimeters, multiply by 185771. This works in ExtendScript because the property is expressed as decimal integer. Below is an excerpt from the FDK manual that provides other conversion factors. Hope this helps some.

Russ

Using MetricT values for linear measurements

When used for linear measurement, a MetricT unit represents a point (1/72 inch). The

16 most significant bits of a MetricT value represent the digits before the decimal;

the 16 least significant bits represent the digits after the decimal. Therefore, 1 point is

expressed as hexadecimal 0x10000 or decimal 65536.

The following table lists the units of the measurement systems FrameMaker products

support and their MetricT equivalents.

Likes

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
Reply
Loading...
Mar 21, 2017 2
Adobe Community Professional ,
Mar 21, 2017

Copy link to clipboard

Copied

ExtendScript for FrameMaker uses a non-intuitive measurement system. There are 65536 "units" in a Postscript point. I like to work on points, so I usually set a constant in my script like this:

var PT = 65536;

So, if want to set something to 144 points wide, I simply use:

textFrame.Width = 144 * PT;

In your case, you can set a constant for millimeters. 1 millimeter is equal to 2.834645669 points , so you could use:

var MM = 65536 * 2.834645669;

Here is an example that sets the properties you want:

#target framemaker

var MM = 65536 * 2.834645669;

var doc = app.ActiveDoc;

doc.PDFPageWidth = 210 * MM;

doc.PDFPageHeight = 297 * MM;

Likes

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
Reply
Loading...
Mar 21, 2017 2