Skip to content

Commit

Permalink
Fonts and drawing
Browse files Browse the repository at this point in the history
  • Loading branch information
johnwhitington committed May 5, 2024
1 parent 76419e1 commit ade8e6d
Show file tree
Hide file tree
Showing 5 changed files with 712 additions and 0 deletions.
40 changes: 40 additions & 0 deletions cpdflibtest.js
Original file line number Diff line number Diff line change
Expand Up @@ -1049,25 +1049,65 @@ console.log("---cpdf_drawJPEG()");
cpdf.drawJPEG("A", "testinputs/jpg.jpg");
console.log("---cpdf_drawJPEGMemory()");
console.log("---cpdf_drawPNG()");
cpdf.drawPNG("B", "testinputs/png.png");
console.log("---cpdf_drawPNGMemory()");
console.log("---cpdf_drawImage()");
cpdf.drawImage("A");
cpdf.drawMScale(0, 0, 0.95, 0.95);
cpdf.drawImage("B");
cpdf.drawMScale(0, 0, 0.95, 0.95);
//cpdf.drawImage("A2");
cpdf.drawMScale(0, 0, 0.95, 0.95);
//cpdf.drawImage("B2");
cpdf.drawPop();
console.log("---cpdf_drawFillOpacity()");
cpdf.drawFillOpacity(0.5);
console.log("---cpdf_drawStrokeOpacity()");
cpdf.drawStrokeOpacity(0.5);
cpdf.drawCircle(0., 0., 300.);
cpdf.drawStrokeFill();
console.log("---cpdf_drawBT()");
cpdf.drawBT();
console.log("---cpdf_loadFont()");
cpdf.loadFont("A", "testinputs/NotoSans-Black.ttf");
console.log("---cpdf_drawFont()");
cpdf.drawFont("Times-Roman");
console.log("---cpdf_drawFontSize()");
cpdf.drawFontSize(15.0);
console.log("---cpdf_drawText()");
cpdf.drawText("Hello!");
console.log("---cpdf_drawSText()");
cpdf.drawSText("Page %Page with bates |%Bates|");
console.log("---cpdf_drawET()");
cpdf.drawET();
cpdf.drawMTrans(100, 100);
cpdf.drawDash("0");
cpdf.drawStrokeColGrey(1.0);
cpdf.drawThick(0.5);
console.log("---cpdf_drawCharSpace()");
cpdf.drawCharSpace(10.0);
console.log("---cpdf_drawWordSpace()");
cpdf.drawWordSpace(20.0);
console.log("---cpdf_drawTextScale()");
cpdf.drawTextScale(70.0);
console.log("---cpdf_drawRenderMode()");
cpdf.drawRenderMode(1);
console.log("---cpdf_drawRise()");
cpdf.drawRise(10.0);
cpdf.drawBT();
cpdf.drawText("With parameters...");
console.log("---cpdf_drawLeading()");
cpdf.drawLeading(30.0);
console.log("---cpdf_drawNL()");
cpdf.drawNL();
cpdf.drawText("another line...");
cpdf.drawNL();
cpdf.drawText("and yet more......");
cpdf.drawET();
console.log("---cpdf_drawNewPage()");
cpdf.drawBT();
cpdf.drawText("Another page");
cpdf.drawET();
console.log("---cpdf_drawEndExtended()");
//console.log("---cpdf_drawEnd()");
//cpdf.drawEnd(draw, drawall);
Expand Down
2 changes: 2 additions & 0 deletions exports.ml
Original file line number Diff line number Diff line change
Expand Up @@ -996,6 +996,8 @@ let _ =
checkerror_unit (Cpdf.drawWordSpace a)
method drawTextScale a =
checkerror_unit (Cpdf.drawTextScale a)
method drawRise a =
checkerror_unit (Cpdf.drawRise a)
method drawRenderMode a =
checkerror_unit (Cpdf.drawRenderMode a)
method drawNL =
Expand Down
Loading

0 comments on commit ade8e6d

Please sign in to comment.