Copy link to clipboard
Copied
Hi everyone
I'v learn here in this forum that the document properties ( fonts ) is not reachable by javascript
But is it possible to launch a preflight then collect the report as XML
all by javascript....
from there i'm able to get the info that i want about font embeding.... in xojo
thanks
Copy link to clipboard
Copied
It's possible to run a preflight profile, yes, but I don't think it's possible to collect its results. You can test it out, though.
To do it you use the preflight method of the Document object.
Copy link to clipboard
Copied
Thanks
i'm able to run my preflight and get an XML object
But i can't dig inside the XML further than report.name
when a try to go deeper like
var myValue = oXMLData.report.document.name; (i'v try everything like all node tree to fonts )
i'v got a error undefined
Can you help me to reach the font info
thanks
------------
var oProfile = Preflight.getProfileByName("Pre-fontes")
if( oProfile != undefined )
{
var oThermometer = app.thermometer;
var myPreflightResult = this.preflight( oProfile, false, oThermometer);
var cXMLData = myPreflightResult.report(oThermometer);
var oXMLData = XMLData.parse(cXMLData, false);
var myValue = oXMLData.report.name;
console.println("Purpose: " + oProfile.description);
console.println("myValue: " + myValue);
}
---------------------------------------------------------------
This is a manually export report XML
......
<?xml version="1.0" encoding="UTF-8" ?>
<report>
<document>
<doc_info></doc_info>
<xmp_doc_info></xmp_doc_info>
<pages></pages>
<resources>
<colorspaces></colorspaces>
<fonts>
<font id="FNT1" type="Type1" embedded="1" subset="1" has_unicode_cmap="1">
<name>HelveticaNeue-HeavyCond</name>
<encoding>WinAnsiEncoding</encoding>
</font>
</fonts>
<embedded_files></embedded_files>
</resources>
</document>
</report
Copy link to clipboard
Copied
When you have an XML object, the top-level element is already implied. So you should be able to do this:
var myFonts = oXMLData.document.fonts.name;
-Rick
Copy link to clipboard
Copied
Check that. It should be
var myFonts = oXmlData.document.resources.fonts.name;
or
var myFonts = oXmlData..fonts.name;
Copy link to clipboard
Copied
Sorry, one more time. This time I tested it :-).
var myFonts = xmlObject..fonts.font.name;
Rick
Copy link to clipboard
Copied
Thanks Rick
But i'v got this Error
XML descendants internal method called on incompatible XFAObject
..
is there a way to display full node tree... i doubt that the report is really the full report !!
Copy link to clipboard
Copied
Can you email me a sample PDF with the "Pre-fontes" profile in it? Please send it to rick at frameexpert dot com. Thanks
Copy link to clipboard
Copied
The profile would actually not be in the PDF file, but in a separate file that can be exported from Acrobat's Preflight dialog:
Select the profile you want to export, then click on the "Options" button to bring up the menu and select "Export Preflight Profile" from the menu. This is also how you import a profile (just use the "Import Preflight Profile" option from the menu).
Copy link to clipboard
Copied
When I run this, I get an XML report, but it only contains the embedding information instead of the summary information that you get when you export an XML report from the Profiles.
var oProfile = Preflight.getProfileByName("Pre-fontes")
if ( oProfile != undefined ) {
var oThermometer = app.thermometer;
var myPreflightResult = this.preflight( oProfile, false, oThermometer);
var cXMLData = myPreflightResult.report(oThermometer);
var oXMLData = XMLData.parse(cXMLData, false);
}
console.println (cXMLData.toString ());
I am having the same problem as you: I don't know how to get the full summary programmatically. I am sorry I couldn't help.
-Rick
Copy link to clipboard
Copied
That's what i'v worry
It only report the problematic font ( not embeded )
myValue: <?xml version="1.0" encoding="UTF-8" ?>
<report xsi:schemaLocation="http://www.callassoftware.com/namespace/js js_results_schema.xsd" xmlns="http://www.callassoftware.com/namespace/js" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<fixups>
</fixups>
<results>
<result severity="Info">
<rule>Font not embedded</rule>
<page number="1" hits="1"></page>
</result>
</results>
</report>
Thank you
Copy link to clipboard
Copied
You are parsing XML, so you will have to use the correct syntax to access information in that XML data structure. Look at the documentation for XMLData.parse(). The following will list all fonts in the "fonts" XML node:
var oXMLData = XMLData.parse(cXMLData, false);
var fonts = oXMLData.report.document.resources.fonts;
for (var i=0; i<fonts.nodes.length; i++) {
console.println(fonts.nodes.item(i).name.value);
}
That is, with your manually extracted XML file. I don't know how to get the list of fonts via JavaScript either.
Copy link to clipboard
Copied
Reading the XML will be done in XOJO ( MAC developing software )
But before exporting, i'v to know if the XML contain the info that i need
And " NO "
Its not the report that i need
But the ( Summary ) of preflight... and it's not in acrobat javascript function
Copy link to clipboard
Copied
You may want to talk to the people at Callas (who as you can see based on the schema information in the XML file have written the Acrobat preflight tool), and see if they have a standalone application that does what you need to do.
Copy link to clipboard
Copied
I have already a 3rd party software who can do that
The idea is to use acrobat integrate tool
which everyone ( in the shop ) have in hand
Thanks for the info
Find more inspiration, events, and resources on the new Adobe Community
Explore Now