Boylan -> Cameron fields change

Discussions concerning general integration topics.

Moderator: Phil Barton

Post Reply
slivanov
Posts: 10
Joined: Mon Jan 27, 2014 1:00 pm

Boylan -> Cameron fields change

Post by slivanov »

I have the following function

Code: Select all

protected override PrintJobHandlerResult OnProcess(IPrintJob printJob) { ... }
After updating from Boylan to Cameron the following fields disappeared:

DocReportId - it used to be

Code: Select all

IPrintJobItem.Properties["DocReportId”]
OrderNumber - it used to be

Code: Select all

((IOrder)IPrintJob.Properties["Order"]).Number
FileLocation - this field might not exist anymore. I noticed that they keep the documents loaded in memory so I don’t need to read them from the file system anymore.

I was able to find DocReportId. It’s IDocument.ID now.

I expected to get a PDF document from IPrintJob.Properties["Context"] as Order -> Order.Data -> byte[]
But it appeared to be something else. I couldn’t build a PDF document using that array of bytes.
How to get access to a PDF document in Cameron in order to apply some changes to it?
yatin.t
Posts: 24
Joined: Tue Jan 07, 2014 9:40 am
Location: Raleigh, NC

Re: Boylan -> Cameron fields change

Post by yatin.t »

You can grab the binary representation of the document as given below:

Code: Select all

byte[] content = printJobItem.Properties["Binary"] as byte[];
Hope this helps.
Yatin Tawde
Softpro
Software Engineer
slivanov
Posts: 10
Joined: Mon Jan 27, 2014 1:00 pm

Re: Boylan -> Cameron fields change

Post by slivanov »

So it doesn't save a PDF file to the file system anymore?
Can you help me to locate OrderNumber property?

Thanks.
yatin.t
Posts: 24
Joined: Tue Jan 07, 2014 9:40 am
Location: Raleigh, NC

Re: Boylan -> Cameron fields change

Post by yatin.t »

We provide you with the byte array so you can save it to disk as a PDF and modify it per your requirement. Select code saves a document to disk when you chose the "Save As" option from the bubble menu or "Save" in the distribute document feature.

What is exactly your requirement and what stage in the pipeline have you configured the custom print job handler to run at?

This is how you would get to the order number from the print job:

Code: Select all

IOrder order = printJob.Properties["Order"];
string number = order.Number;
Yatin Tawde
Softpro
Software Engineer
slivanov
Posts: 10
Joined: Mon Jan 27, 2014 1:00 pm

Re: Boylan -> Cameron fields change

Post by slivanov »

IOrder doesn't have Number property anymore. I took a screenshot from the new SDK to show the new IOrder interface but the website doesn't let me to attach a picture.
printJob.Properties["Order"] has Order object which is completely different from IOrder and I can't find information about that class in the SDK.

I don't need to save a PDF file to the file system. Boylan saved a temporary PDF file. I applied changes to the file and it would pick the file up and print it. Now I have to build a PDF document using bytes array from printJobItem.Properties["Binary"], make changes, get the bytes array from the changed PDF document and give it back to the print job.
slivanov
Posts: 10
Joined: Mon Jan 27, 2014 1:00 pm

Re: Boylan -> Cameron fields change

Post by slivanov »

I am guessing it's a dynamic object. This chunk of code helped

Code: Select all

dynamic order = printJob.Properties["Order"];
OrderNumber = order.Number
yatin.t
Posts: 24
Joined: Tue Jan 07, 2014 9:40 am
Location: Raleigh, NC

Re: Boylan -> Cameron fields change

Post by yatin.t »

That is correct. I'm sorry for the typo in my response. You can cast it as dynamic like you have done or do the following if you want to use the IOrder API

Code: Select all

IOrder order = printJob.Properties["Order"];
string number = (string) order["Number"];
You are also on the right path in regards to doing custom PDF processing.
Yatin Tawde
Softpro
Software Engineer
Post Reply