Skip to main content
JADarnell
Inspiring
May 31, 2010
Question

IDCS5 Win Printing Postscript

  • May 31, 2010
  • 2 replies
  • 818 views

I have a plugin that has worked since InDesign 2.0.2.  It prints out each page in a document to a PostScript file.  In CS5 that same code is now broken.  In a simple two-page document with a single, centered picture placed on each page, it prints the first page out as a blank and the picture on the second page is moved to the bottom of the page.

Printing through Adobe's Print Dialog and directly to paper produces the expected pages.  Does anyone have any suggestions as to where to start looking?

I will provide code upon request; it's a rather long snippet which is why I did not include it in this message.

This topic has been closed for replies.

2 replies

JADarnell
JADarnellAuthor
Inspiring
June 2, 2010

Now that I have worked on the code for two days and narrowed down the problem, I can offer up a bit more on specifics.  Here is the code I believe is causing the problem (I have removed all error checking for the sake of brevity):

   //InterfacePtr<ICommand> PrintActionCommand(CmdUtils::CreateCommand(kPrintActionCmdBoss));
   InterfacePtr<ICommand> PrintActionCommand(CmdUtils::CreateCommand(kNewPrintCmdBoss));

   InterfacePtr<IInkList> InkList(CurrDoc -> GetDocWorkSpace(), IID_IINKLIST);

   InterfacePtr<IPrintJobData> PrintJobData(::CreateObject2<IPrintJobData>(kPrintJobDataBoss));
   PrintJobData -> SetInkList(InkList);

   IPrintCmdData::PrintUIOptions uiFlags = IPrintCmdData::kSuppressPrintDialog ;

   InterfacePtr<IPrintCmdData> printActionCmdData(PrintActionCommand, UseDefaultIID());

   printActionCmdData -> SetIDoc(             CurrDoc);
   printActionCmdData -> SetPrintUIOptions(   uiFlags);

   printActionCmdData -> SetInkList(          InkList);  
   printActionCmdData -> SetPrintData(      PrintInfo);
   printActionCmdData -> SetPrintJobData(PrintJobData);

   InterfacePtr<IOutputPages> SinglePage(PrintActionCommand, IID_IOUTPUTPAGES);

   //  PageRef is a class member and is set before each call to this function.
   SinglePage -> InsertOutputPageUIDRef(PageRef);


   PMString               DocName;
   CurrDoc    -> GetName(DocName);
   SinglePage -> SetName(DocName);

   InterfacePtr<ICommand> PrintGatherCommand(CmdUtils::CreateCommand(kPrintGatherDataCmdBoss));

   InterfacePtr<IPrintCmdData> PrintGatherCommandData(PrintGatherCommand, IID_IPRINTCMDDATA);
   
   PrintGatherCommandData -> SetPrintData(      PrintInfo);
   PrintGatherCommandData -> SetPrintJobData(PrintJobData);
   PrintGatherCommandData -> SetPrintUIOptions(   uiFlags);
   PrintGatherCommandData -> SetInkList(          InkList);
  
   Result = CmdUtils::ProcessCommand(  PrintGatherCommand);

   result = CmdUtils::ProcessCommand(PrintActionCommand);

Please note that I have highlighted the first two lines of code in red because that's where my problem seems to lie.

If I use this line in my code (it is now commented out):

   InterfacePtr<ICommand>  PrintActionCommand(CmdUtils::CreateCommand(kPrintActionCmdBoss));

The pages print out exactly as expected but the user is required to manually enter the name for each PostScript file, which is unacceptable.  Additionally (and not unexpectedly once one looks at the documentation) the attempt to create an IOutputPages interface fails, so when this line is not commented out, the code that creates and fills in the SinglePage object, is commented out.

If I use this line in my code:

   InterfacePtr<ICommand>  PrintActionCommand(CmdUtils::CreateCommand(kNewPrintCmdBoss));

The IOutputPages interface is created without a problem, the PostScript files are generated without the user having to manually enter the filenames, but as mentioned in my first post, the PDF files generated from the PostScript is wrong.  Specifically, all objects on the first page are shifted down approximately 5.375 inches (approx. 13.7 centimeters) and to the right approximately 8.25 inches (approx. 21 centimeters).  All objects on the second page are shifted down 5.375 inches only.  There is no right shifting on page 2.

For the fun of it, I added a third page and found that the behavior of the objects on it mimicked the behavior of the objects on the first page.

I have examined all the interfaces used here and cannot see where the problem may lay.  If any of you see what I am doing wrong, I would be grateful for your input.

TIA!

John

Inspiring
June 4, 2010

I am using kPrintActionCmdBoss.

kPrintActionCmdBoss doesn't have IOutputPages interface.

Use IPrintData::SetPageRange and IPrintData::SetFileName method.

JADarnell
JADarnellAuthor
Inspiring
June 4, 2010

Hello Norio.  Thanks for posting a reply.

In my second post to this thread I tried to make it clear that I have tried both bosses and each has its own drawback.  I also tried to point out that kPrintActionCmdBoss did not have an IOutPages interface when I talked about examining the documentation.  I am sorry that I did not make either point clear enough.

WRT the suggestion that I use IPrintData::SetFileName and IPrintData::SetPageRange (which also needs IPrintData::SetWhichPages), I am already setting them, but since I didn't say so, you had no way of knowing.  Again, I apologize for the lack.

If anyone knows where I can report a bug to Adobe, I have come to the conclusion that the behavior exhibited by kNewPrintCmdBoss is a bug and I would like to report it.  I cannot find it on the Partner portal.

R,

John

Inspiring
June 1, 2010

My plug-ins work fine on InDesign CS - CS5 Mac and Win.

I can't see your problem.