Alambic Error Media Size is invalid

Hello,

I have a Workflow configuration where I want to create a new PDF via Alambic script to merge an area of another PDF on it.

var newPDF = Watch.GetPDFEditObject();
var jobPDF = Watch.GetPDFEditObject();
var newRect = new ActiveXObject("AlambicEdit.PdfRect")
var jobRect = new ActiveXObject("AlambicEdit.PdfRect")

jobPDF.Open(Watch.GetJobFileName(),false);
// Current job page size
jobRect = jobPDF.Pages(0).Size();

newPDF.Create("C:\\PLANETPRESS\\newFile.pdf");

newRect.left    = 0;
newRect.top     = 50; // need: 7 points = 2.5 mm
newRect.right   = 100; // need: 48 points = 17 mm
newRect.bottom  = 0;
newPDF.Pages().Insert(0,newRect);

newPDF.Pages(0).Merge2(jobPDF.Pages(0),-93,-459,0,1.0);
newPDF.Save(false);

I get the following error in debug mode:

[0002] W3602 : Error 0 on line 17, column 1: AlambicEdit.AlambicEditPDF.1: Media size is invalid.

Line 17: newRect.top = 50;

I have tested different values. 72 points ( newRect.top = 72; ) seems to be the minimum size.

Do I have any chance to do what I need (crop a pdf to 17x2.5mm)?

Thanks
Thomas

To prevent programmer mistakes, the AlambicEdit API limits the page size to be at least 72x72.

You could circumvent this limitation by creating a simple PostScript job that produces a page of the desired size, distill it to a PDF using the Digital Action task and then insert pages from that PDF.

Here is an example of such PostScript job.

%!PS
<< /PageSize [24 28] >> setpagedevice
showpage

where 24 is the page width and 28 is the height.

Thank you for that workaround. I will give it a try.