PDF-XChange - Tracker PDF Viewer - TIFF-XChange - Image-XChange - XMF-XChange - Raster-XChange - Support

Moderators: TrackerSupp-Daniel, Tracker Support, Chris - Tracker Supp, Vasyl-Tracker Dev Team, Sean - Tracker, Tracker Supp-Stefan

Forum rules
DO NOT post your license/serial key, or your activation code - these forums, and all posts within, are public and we will be forced to immediately deactivate your license.

When experiencing some errors, use the IAUX_Inst::FormatHRESULT method to see their description and include it in your post along with the error code.
 
whoit
User
Topic Author
Posts: 262
Joined: Tue Jul 07, 2015 3:30 pm

DrawRect usage

Mon Feb 26, 2018 7:45 pm

Hi -

Can you point me to an example of using DrawRect within the CoreAPI ?
Or, whatever similar methods are available - I only need to draw a simple rectangle on my pdf.

(I'm actually trying to draw a simple frame around TextBlock, in case there's another way)

Thanks.
 
User avatar
Sasha - Tracker Dev Team
User
Posts: 3703
Joined: Fri Nov 21, 2014 8:27 am
Contact:

Re: DrawRect usage

Tue Feb 27, 2018 8:45 am

Hello Wayne,

Here's a sample on this matter:
https://gist.github.com/Polaringu/bee53d4857332d010aef677741e8bf79

Cheers,
Alex
Join us at Google+:
https://plus.google.com/+PDFXChangeEditorTS
Subscribe at:
https://www.youtube.com/channel/UC-TwAMNi1haxJ1FX3LvB4CQ
 
whoit
User
Topic Author
Posts: 262
Joined: Tue Jul 07, 2015 3:30 pm

Re: DrawRect usage

Tue Apr 10, 2018 2:23 pm

Hi Alex -

Do you have similar code using CoreAPI instead of Editor?
Most of the code refers to APIs that don't exist in the Core...pen, brush, drawrect, etc....
 
User avatar
Sasha - Tracker Dev Team
User
Posts: 3703
Joined: Fri Nov 21, 2014 8:27 am
Contact:

Re: DrawRect usage

Thu Apr 12, 2018 8:02 am

Hello Wayne,

You have referred to the DrawRect method, and the only DrawRect method that I found was the IUIX_RenderContext::DrawRect method. Thus I gave you a sample that I had.
What you need is the IPXC_ContentCreator - it does all of the drawing/output that you require. Here's a small sample, that you can modify to your needs:
PXC_Rect rc;
IPXC_Document doc = CreateNewDocument(out rc);
PDFXEdit.IPXC_ContentCreator CC = doc.CreateContentCreator();
PDFXEdit.PXC_Rect rcText;
rcText.left = 100;
rcText.bottom = 600;
rcText.top = 700;
rcText.right = 300;

PDFXEdit.PXC_Rect rcBlock;
PDFXEdit.IPXC_CharFormat cf = pxcInst.CreateCharFormat();
CC.ShowTextBlock("Test Text Block Text", rcText, rcText, 0, -1, null, null, null, out rcBlock);  //draw text block
CC.SetLineWidth(2);
CC.Rect(rcBlock.left, rcBlock.bottom, rcBlock.right, rcBlock.top);
CC.StrokePath(true);
doc.Pages[0].PlaceContent(CC.Detach(), (UInt32)PDFXEdit.PXC_PlaceContentFlags.PlaceContent_After);

pdfCtl.OpenDocFrom(doc);


Cheers,
Alex
Join us at Google+:
https://plus.google.com/+PDFXChangeEditorTS
Subscribe at:
https://www.youtube.com/channel/UC-TwAMNi1haxJ1FX3LvB4CQ
 
whoit
User
Topic Author
Posts: 262
Joined: Tue Jul 07, 2015 3:30 pm

Re: DrawRect usage

Mon Apr 16, 2018 1:29 pm

Yeah, I assumed that there was a comparable API in Core but wasn't sure of the name....thanks.
 
User avatar
Tracker Supp-Stefan
Site Admin
Posts: 13078
Joined: Mon Jan 12, 2009 8:07 am
Location: London
Contact:

Re: DrawRect usage

Mon Apr 16, 2018 2:01 pm

You are welcome whoit,

Regards,
Stefan

Who is online

Users browsing this forum: No registered users and 1 guest