Copy window area of PDF and paste...

PDF-XChange Editor SDK for Developers

Moderators: TrackerSupp-Daniel, Tracker Support, Paul - Tracker Supp, Vasyl-Tracker Dev Team, Chris - Tracker Supp, Sean - Tracker, Ivan - Tracker Software, 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.
Post Reply
lidds
User
Posts: 510
Joined: Sat May 16, 2009 1:55 pm

Copy window area of PDF and paste...

Post by lidds »

What I want to do is allow the user to be able to define a rectangle on a PDF document, like your crop tool, and then be able to copy and paste this onto an existing blank PDF page. Is something like this achivable? And if so how?

Thanks in advance

Simon
Sasha - Tracker Dev Team
User
Posts: 5522
Joined: Fri Nov 21, 2014 8:27 am
Contact:

Re: Copy window area of PDF and paste...

Post by Sasha - Tracker Dev Team »

Hello Simon,

Would Snapshot tool work for you?

Cheers,
Alex
Subscribe at:
https://www.youtube.com/channel/UC-TwAMNi1haxJ1FX3LvB4CQ
lidds
User
Posts: 510
Joined: Sat May 16, 2009 1:55 pm

Re: Copy window area of PDF and paste...

Post by lidds »

Alex,

I have tried the snapshot tool, however I am unable to paste this onto an existing blank PDF document. Tried right click and paste but the snapshot image is not pasted?

Simon
Sasha - Tracker Dev Team
User
Posts: 5522
Joined: Fri Nov 21, 2014 8:27 am
Contact:

Re: Copy window area of PDF and paste...

Post by Sasha - Tracker Dev Team »

Hello Simon,

There will be a new major release soon with vast snapshot tool update - I say wait till then.

Cheers,
Alex
Subscribe at:
https://www.youtube.com/channel/UC-TwAMNi1haxJ1FX3LvB4CQ
lidds
User
Posts: 510
Joined: Sat May 16, 2009 1:55 pm

Re: Copy window area of PDF and paste...

Post by lidds »

Alex,

I need to release my software on Wednesday, so can't really wait.

I do however have another idea, is it possible to add a clip region to an existing document and then export the clipped region to a new pdf file and then add white space around the clipped region, so that the user has some white space to add annotation to?

Thanks

Simon
Sasha - Tracker Dev Team
User
Posts: 5522
Joined: Fri Nov 21, 2014 8:27 am
Contact:

Re: Copy window area of PDF and paste...

Post by Sasha - Tracker Dev Team »

Hello Simon,

Probably the snapshot tool will work for you in some case. The snapshot tool itself is an selection.pageRect type selection. Basically you can catch it with the e.docSelection.changed event and casting the parameters to the IPXV_PageRectSelection interface:

Code: Select all

else if (e.nEventID == nIDS[(int)IDS.e_docSelection_changed])
{
				
	PDFXEdit.IPXV_Document Doc = (PDFXEdit.IPXV_Document)e.pFrom;
	uint nLen = e.pEvent.Param2;
	var buffer = new int[nLen];
	IntPtr ptr = new IntPtr(e.pEvent.Param1);
	if ((ptr != null) && (nLen != 0))
	{
		Marshal.Copy(ptr, buffer, 0, (int)nLen);
		for (uint i = 0; i < nLen; i++)
		{
			IPXV_DocSelection docSel = Doc.GetSelCluster(buffer[i]);
			IPXV_PageRectSelection prs = docSel as IPXV_PageRectSelection;
The you can get the PageRect property out of it and use it to export the content items that are in that rectangle.

Cheers,
Alex
Subscribe at:
https://www.youtube.com/channel/UC-TwAMNi1haxJ1FX3LvB4CQ
Post Reply