Copy link to clipboard
Copied
I
How do you get Acrobat pragmatically printing tiled (poster) settings? I know what the support (reference document for Javascript states). Use TileAll.... that did not work at all. I have large images that I need to add a couple barcodes to the top and then print without changing the size of the image. So they need to print out at 100%. I can do it manually but I need to automate this process ASAP. Can someone help me? Right now I have a C# app that sends the document through OLE to open, now I just need to modify and PRINT tiled. Of course, this process needs to be duplicatable. I wanted to do this all in OLE but I do not see where I can modify the printer settings.... therefore I was thinking OLE to Javascript. I could do OLE to plugins also but I can not get my new plugin (sample for SDK) to even show up.
I am using Acrobat Pro DC.
Thanks
Kory
How do you get Acrobat pragmatically printing tiled (poster) settings
Copy link to clipboard
Copied
If a sample plugin doesn't show up it may be that it isn't supposed to. A plugin only adds to menus or About if it contains code to do so.
Copy link to clipboard
Copied
I can not seem to get the sample plugin to show up in loaded plugins so I am not sure what I am doing wrong there....
Thanks
Kory
Copy link to clipboard
Copied
Have you tried writing the JavaScript and then calling that? That’s certainly easiest.
Copy link to clipboard
Copied
This is what I wrote through the samples... I want to be able to call this from C#. I am VERY VERY new at acrobat objects and trying to code them in javascript. Does the js file get reloaded everytime I close and open acrobat?
function TilePrint(theDoc)
{
pp = this.getPrintParams();
//pp.pageHandling = pp.constants.handling.nUp;
pp.pageHandling = pp.constants.handling.tileAll;
pp.interactive = pp.constants.interactionLevel.silent;
pp.nUpPageOrders = pp.constants.nUpPageOrders.Horizontal;
pp.nUpNumPagesH = 2;
pp.nUpNumPagesV = 2;
pp.nUpPageBorder=true;
this.print(pp);
}
Copy link to clipboard
Copied
It’s better to just pass that as part of an “execute this javascript” call. There are samples in the SDK.
Copy link to clipboard
Copied
Ok this is odd I renamed my file and reran my script with a new name and I got multiple pages. Although I got an annoying "Do you want to Print" is that a function I can turn off? I set the interaction level to silent... is that some other level? ok So I create them through the console how do I remove them once I have installed them?
Kory
Copy link to clipboard
Copied
Silent printing isn’t supported due to security concerns
Copy link to clipboard
Copied
Is there any way around this? I am trying to write this to save the users time.... That is probably why I am getting false when I try to run it in C# call acroapp.MenuItemExecute("TilePrint"); ....
Please let me know.
BTW thanks for the quick responses.
Kory
Here is my Javascript in entirety... so far a lot more to do just trying to get through this first
/*********************************************************************
CREATE THE INFORMATION TO PRINT
---------------------------------------------------------------------
TilePrint.js
- Folder level Javascript code created by Adobe Acrobat SDK.
*********************************************************************/
/*
* The sample will add "UEI Modify and Print" under Acrobat File menu.
* Click it to print the front document to the default printer without user interface.
* It works for Reader, too.
*
* See Acrobat JavaScript reference and guide SDK documents for further information.
*/
if ( typeof sdkMenuItem == "undefined")
var sdkMenuItem = false;
if (!sdkMenuItem) {
sdkMenuItem = true;
app.addSubMenu( {
cName:"ACROSDK:JSSubMenu",
cUser: "Acrobat SDK JavaScript",
cParent: "Edit",
nPos: 0
});
}
/*
* Add a menu item
* you can execute this menu item from other programs such as IAC VB / VC code.
*/
app.addMenuItem( {
cName: "ACROSDK:TilePrint",
cUser: "TilePrint",
cParent: "ACROSDK:JSSubMenu",
cEnable: "event.rc = (event.target != null);",
cExec: "TilePrint(event.target)"
});
/**
* trustedPrint function: Exercise the print function in the privileged context
*
* @param doc The Doc object of the target document
* @param pparam The PrintParams object containing print settings
*/
trustedPrint = app.trustedFunction(
function(doc, pparams) {
app.beginPriv();
doc.print(pparams);
app.endPriv();
}
);
/**
* Main function: Print silently
*
* @param theDoc The event target of executing the menu item of this sample.
*/
function TilePrint(theDoc)
{
pp = this.getPrintParams();
//pp.pageHandling = pp.constants.handling.nUp;
pp.pageHandling = pp.constants.handling.tileAll;
pp.interactive = pp.constants.interactionLevel.silent;
pp.nUpPageOrders = pp.constants.nUpPageOrders.Horizontal;
pp.nUpNumPagesH = 2;
pp.nUpNumPagesV = 2;
pp.nUpPageBorder=true;
this.print(pp);
}
Copy link to clipboard
Copied
You can write a custom plugin, that still allows silent print because it requires a user to manually install it.
Otherwise, no. The whole point of security is to not be worked around.
Copy link to clipboard
Copied
OK so I get to the point of not seeing the plugins I built being loaded... Javascript you load through the console how do I get plugins installed? I placed snippet runner in the plugin directory and it did not load. I will look into the SDKs to see if I can get familiar with the plugins building also. I am familiar with Javascript and have modified some C++ but have not made something like this....
Thanks
Kory
Copy link to clipboard
Copied
Actually, it is possible to tile and silently print. You have to trust the directory that the file you are trying to silently print is in. Then it works fine.
Kory
Copy link to clipboard
Copied
How do you KNOW that snippet runner didn't load? What exactly did you look for to see whether it loaded? Don't assume ANYTHING.
Copy link to clipboard
Copied
ok I did not see it in the help => plugins. OK, so I put the plugin in the plugin directory and then I should be able to access it through C# I hope.... I will see if I can find some code on that through the SDK. Any hints on where to start would be greatly appreciated. It has taken me too long to get to this point. Part of that is I did not post here.... Plus most of the time I try to get all the information myself.
Thanks
Kory
Copy link to clipboard
Copied
> I did not see it in the help => plugins.
Common assumption. A plug-in appears there if it has code to put itself there. It isn't done by Acrobat, and the plug-in might or might not do that. Read the code.
> I should be able to access it through C#
You can run a named menu item, by its internal code, with no parameters or user interface. Don't assume you can easily do anything else.
Copy link to clipboard
Copied
Thanks, I will see if I have more questions come up as I go back to the drawing board....
Copy link to clipboard
Copied
Ok, I have gotten a start and already have run into something that I need assistance.
How do I set up the code to tile??
/*-------------------------------------------------------
Replaced method callback implementation
-------------------------------------------------------*/
ACCB1 void ACCB2 UEIAVDocDoPrint (AVDoc doc)
{
// TODO: Implement your replacement function
PDDoc d = (PDDoc)doc;
if (d == NULL){
return;
}
AVDocPrintParamsRec r;
memset(&r, 0, sizeof(AVDocPrintParamsRec));
r.size = sizeof(AVDocPrintParamsRec);
r.pageSpec = PDAllPages;
// if true, displays dialog boxes; otherwise does not display dialog boxes.
r.emitToPrinter = true; // only emitToPrinter or emitToFile must be true
r.emitToFile = false;
r.interactive = false; // sets no user interaction
r.cancelDialog = true;
r.emitFontOption = kAVEmitFontAllFonts;
r.ranges = NULL;
r.numRanges = 0;
r.printAsImage = false;
r.reverse = false;
AVDocPrintTileDataRec tdr;
memset(&tdr, 0, sizeof(AVDocPrintTileDataRec));
tdr.scale = 1;
r.transparencyLevel = 3; //The transparency level range from 1 to 5
ASInt32 error = 0;
DURING
AVDocPrintPagesWithParams((AVDoc)doc, &r);
HANDLER
error = ERRORCODE;
ASRaise(error);
END_HANDLER
}
I think I need to do something with tiledata but that does not seem like enough....
Some assistance, please.
Thanks
Kory
Copy link to clipboard
Copied
Looking over your code I see multiple problems - the usual errors when starting out with plugins - in your use of AVDocPrintTileDataRec
Almost all the plugin structures require you to zero the area and set a length. You do not set a length.
You set an ASFixed value to the integer 1. ASFixed must not be treated as integer, it's a special opaque type and you must convert to/from C types.
As far as I can see you create the structure but do not pass its address, directly or indirectly, to any API.
Find more inspiration, events, and resources on the new Adobe Community
Explore Now