Two Pilots™    Home  |  Navigation  |  Site Map  |  Products  |  Download  |  Prices  |  For Partners  |  Support


All forums · Statistics · Search ·

Two Pilots forum / For software developers / PDFPAGE_Clip
Author Message
Mihai
Member
# Posted: 30 May 2007 10:14


Hello ,

I am trying to draw two clipped texts in a PDF but I did not find a way to do that.
The code I think should be correct , though it is not working as expected ( draws only the text in the region: 0 ,0 ,100 , 100 ), is the following :

// first clipping region
PDF->PDFPAGE_NewPath();
PDF->PDFPAGE_Rectangle(0, 0, 100 , 100);
PDF->PDFPAGE_ClosePath();
PDF->PDFPAGE_Clip();
PDF->PDFPAGE_GStateSave();// save the first clipping region

// the second clipping region
PDF->PDFPAGE_NewPath();
PDF->PDFPAGE_Rectangle(200, 200, 300, 300);
PDF->PDFPAGE_ClosePath();
PDF->PDFPAGE_Clip();
PDF->PDFPAGE_TextOut(250, 250, 0, "HELLO, PDF!");// text for the second clipping //region

PDF->PDFPAGE_GStateRestore();// get back the first clipping region
PDF->PDFPAGE_TextOut(10, 40, 0, "HELLO, PDF!");// text for the first clipping region


Is there a way to draw the two texts clipped ?

Thanks ,
Mihai

Stanislav
Member
# Posted: 30 May 2007 10:39


Dear Mihai,

If i understand you right, you want to implement something like this:

Set PDF = CreateObject("PDFCreatorPilot3.PDFDocument3")
PDF.StartEngine "demo@demo", "demo"
PDF.Filename = "Clip.pdf"
PDF.AutoLaunch = true

PDF.BeginDoc

PDF.PDFPAGE_GStateSave
PDF.PDFPAGE_NewPath

PDF.PDFPAGE_Rectangle 0, 0, 100, 100


PDF.PDFPAGE_ClosePath
PDF.PDFPAGE_Clip
PDF.PDFPAGE_GStateRestore

PDF.PDFPAGE_GStateSave
PDF.PDFPAGE_NewPath
PDF.PDFPAGE_Rectangle 200, 200, 300, 300

PDF.PDFPAGE_ClosePath
PDF.PDFPAGE_Clip
PDF.PDFPAGE_TextOut 250, 250, 0, "HELLO, PDF - 250,250!" ' text for the second clipping //region

PDF.PDFPAGE_GStateRestore ' get back the first clipping region
PDF.PDFPAGE_TextOut 10, 40, 0, "HELLO, PDF - 10,40!" ' text for the first clipping region

PDF.EndDoc

Best regards,
Stanislav
Two Pilots
www.colorpilot.com

Stanislav
Member
# Posted: 30 May 2007 10:39


it's a VBScript example

Mihai
Member
# Posted: 31 May 2007 02:59


Hello Stanislav ,

The idea of the code that I am trying to write is to draw :
- the text "HELLO, PDF - 10,40!" clipped by the rectangle (0, 0, 100, 100)
and
- the text "HELLO, PDF - 250,250!" clipped by the rectangle (200, 200, 300, 300)

on the same page of a PDF document.

I implemented the equivalent C++ code of the VBScript code you posted, but it still does not draw the two texts clipped. Just the second text , "HELLO, PDF - 250,250!" is clipped by the rectangle (200, 200, 300, 300).


Regards ,
Mihai

Stanislav
Member
# Posted: 31 May 2007 09:31


Dear Mihai,

If i'm right, you want to clip them nested - or this is not required ? Maybe you need to clip them separately ?

Best regards,
Stanislav
Two Pilots
www.colorpilot.com

Mihai
Member
# Posted: 1 Jun 2007 02:17


Hello ,

The idea is to clip the two texts separately , so that each text has it's own clipping rectangle.

Regards,
Mihai

Mihai
Member
# Posted: 13 Jun 2007 00:47


Hello ,

any news about how to draw in the same page of a PDF doc using two separate clipping regions (only one region active when callign drawing functions) ?

Regards ,
Mihai

Stanislav
Member
# Posted: 13 Jun 2007 07:38


Dear Mihai,

You can use only one active clipping region simoultaneously.

Best regards,
Stanislav
Two Pilots
www.colorpilot.com

Mihai
Member
# Posted: 18 Jun 2007 01:29


Hello Stanislav ,

My question still remains the same: can two distinct clipping regions be used on the same page of a PDF document? Please , have in mind the fact that only one region is active when calling drawing functions for that page.
Any help in this problem will be very useful.

Thanks,
Mihai

Stanislav
Member
# Posted: 21 Jun 2007 05:22


Dear Mihai,

Yes, of course - here i an example, clipping regions are stroked.

Set PDF = CreateObject("PDFCreatorPilot3.PDFDocument3")
PDF.StartEngine "demo@demo", "demo"
PDF.Filename = "Clip.pdf"
PDF.AutoLaunch = true

PDF.BeginDoc

PDF.PDFPAGE_GStateSave
PDF.PDFPAGE_NewPath
PDF.PDFPAGE_Rectangle 0, 0, 100, 100

PDF.PDFPAGE_ClosePath
PDF.PDFPAGE_Clip
PDF.PDFPAGE_TextOut 10, 40, 0, "HELLO, PDF - 10,40! -------------" ' text for the first clipping region
PDF.PDFPAGE_Rectangle 0, 0, 100, 100
PDF.PDFPAGE_Stroke
PDF.PDFPAGE_GStateRestore

PDF.PDFPAGE_GStateSave
PDF.PDFPAGE_NewPath
PDF.PDFPAGE_Rectangle 200, 200, 300, 300
PDF.PDFPAGE_ClosePath
PDF.PDFPAGE_Clip
PDF.PDFPAGE_TextOut 250, 250, 0, "HELLO, PDF - 250,250! -------------" ' text for the second clipping //region
PDF.PDFPAGE_Rectangle 200, 200, 300, 300
PDF.PDFPAGE_Stroke
PDF.PDFPAGE_GStateRestore ' get back the first clipping region
PDF.EndDoc


Best regards,
Stanislav
Two Pilots
www.colorpilot.com

Mihai
Member
# Posted: 22 Jun 2007 04:44


Thanks for the sample Stanislav. It does what I was looking for.

There still is a thing that is good to be fixed for the 'PDF Creator Pilot' library:
to make work the clipping when using GDI drawing functions (Eg.: TextOut(HDC , ... ) ).

Thanks again ,
Mihai

Stanislav
Member
# Posted: 25 Jun 2007 02:09


Dear Mihai,

This is already fixed, new build will be available soon.

Best regards,
Stanislav
Two Pilots
www.colorpilot.com

Stanislav
Member
# Posted: 25 Jun 2007 07:51


Dear Mihai,

The build is available now from our website.

Best regards,
Stanislav
Two Pilots
www.colorpilot.com

 

 

Powered by miniBB 2.0 RC7 © 2001-2004 Page creation time (sec.): 0.015

 

Page top