Copy link to clipboard
Copied
I am looking to create a new PDF with lines drawn on it.
I was wondering if there was a way to draw lines/shapes on PDF using JavaScript. ( I know that this can be achieved by C++ coding or the comment mode function in PDF)
An even easier solution is to use the line markup annotation.
this.addAnnot({type:"Line", page:0, points:[....]});
There are all kinds of graphical annotations. Keep in mind these are not part of the PDF page content.
Read this:
https://www.pdfscripting.com/public/PDF-Page-Coordinates.cfm?sd=40
If this will be performed from a privileged script, then there are more possibilities for new document create with JavaScript. For example flattening will push anntation and field appearances into the
...Copy link to clipboard
Copied
No, there is not a way to do that with JavaScript in PDF.
Copy link to clipboard
Copied
Actually there is a way. Just have to be a little creative.
var SV1=this.getField("line1");SV1.rect = [45,517.5,409.5,516.8];
var SV2=this.getField("line2");SV2.rect = [45,504.648,409.5,503.948];
var SV3=this.getField("line3");SV3.rect = [45,491.976,409.5,491.276];
var SV4=this.getField("line4");SV4.rect = [45,479.304,409.5,478.604];
var SV5=this.getField("line5");SV5.rect = [45,466.632,409.5,465.932];
and then just make sure each of those field box has a border outline
Copy link to clipboard
Copied
An even easier solution is to use the line markup annotation.
this.addAnnot({type:"Line", page:0, points:[....]});
There are all kinds of graphical annotations. Keep in mind these are not part of the PDF page content.
Read this:
https://www.pdfscripting.com/public/PDF-Page-Coordinates.cfm?sd=40
If this will be performed from a privileged script, then there are more possibilities for new document create with JavaScript. For example flattening will push anntation and field appearances into the PDF content. And there is the Report Object, which has the ability to create horizontal lines.