URL in pdf

This Forum is for the use of Clarion For Windows - Software Developers requiring help and assistance for Tracker Software's PDF-Tools SDK of Library DLL functions(only) - Please use the PDF-XChange Drivers API SDK Forum for assistance with all PDF Print Driver related topics.

Moderators: TrackerSupp-Daniel, Tracker Support, Vasyl-Tracker Dev Team, Sean - Tracker, Chris - Tracker Supp, Tracker Supp-Stefan, Ivan - Tracker Software, Tracker - Clarion Support, John - Tracker Supp, Support Staff, moderators

Post Reply
jrademan
User
Posts: 9
Joined: Sat Mar 22, 2008 11:00 am

URL in pdf

Post by jrademan » Mon Mar 24, 2008 5:56 am

Hi,

How do I insert text into pdf and it displays 'abc' but it is an url to a website without displaying the url info in the PDF.

thanks

Johan

Lzcat - Tracker Supp
Site Admin
Posts: 712
Joined: Thu Jun 28, 2007 8:42 am

Post by Lzcat - Tracker Supp » Mon Mar 24, 2008 8:44 am

The Common way to do this - place your text 'abc' and add link annotation to the corresponding rect.

If you creating new pdf file using pxclib30.dll (pxclib40.dll) you should use PXC_AddLink function. Or, if pdf file is alredy created you should use the PXCp_AddLink function from xcpro35.dll (xcpro40.dll when V4 is released later this week).

In both cases you need to specify the rect on the page and the URL string.

See the corresponding help file for more details.
Victor
Tracker Software
Project manager

Please archive any files posted to a ZIP, 7z or RAR file or they will be removed and not posted.

johanr
User
Posts: 14
Joined: Sun Sep 24, 2006 6:02 am

Post by johanr » Tue Mar 25, 2008 8:32 am

Hi Victor

I am currently using TextOut to place the text and then would like to straight after that add the link for that piece of text.

Are there any examples that could provide same sample code?

I have been through some of the examples but am struggling to find one.

thanks

Johan

John - Tracker Supp
Site Admin
Posts: 8202
Joined: Tue Jun 29, 2004 10:34 am
Location: Vancouver Island - Canada
Contact:

Post by John - Tracker Supp » Tue Mar 25, 2008 5:00 pm

Hi Johan,

best you place your messages in the Clarion forum - then you will get a Clarion developer to answer you - rather than our C++/VB/C#/DOTNET generic dev's trying to answer.

Craig will respond as soon as possible.
If posting files to this forum - you must archive the files to a ZIP, RAR or 7z file or they will not be uploaded - thank you.

Best regards
Tracker Support
http://www.tracker-software.com

Tracker - Clarion Support
Site Admin
Posts: 1412
Joined: Wed Jun 30, 2004 4:45 pm
Location: Maryland, USA
Contact:

Post by Tracker - Clarion Support » Tue Mar 25, 2008 11:22 pm

Hi Johan!

John asked me to look at your problem.

First, you can only add text to a NEW PDF, not one that you have already created. This is because the PDF Specification, to which our software adheres, differentiates between "Content" - text and images - which should never change once created, and a variety of "Annotations" which may be added, changed or deleted after PDF creation. There are also "Fields" which are a feature of the Acrobat Forms (or "AcroForms") capability which may contain default text that may be changed by the user using a Viewer capable of that.

Links are considered to be Annotations and are NOT tied to any text but to an area of the PDF page. If that area happens to surround a word or words, then clicking on the word will be inside the active area of the link ("hotspot") and the link will be activated.

One thing you might try is to look at the C++ example that you can find in the PDF-XChange PRO 3.5 Library Help for function PXCp_ET_AnalyzePageContent by clicking the 4th button on the help page toolbar (mostly blue and tooltipped as "Usage examples (1)". That shows how to extract ALL the text from an existing PDF and copy it to a new PDF retaining the font formatting. You could insert code to search for your "keywords" in each text element (line) and then replace them where they appear. You would have to fix up the PXP_TextElement contents to reflect the changes. Notice that the PXP_TextElement character array information includes the baseline and offset information for each word in the line so you could save that to build a Link around the word(s) as necessary. Not simple but it would work.

Alternatively, you could create an opaque foreground Text Watermark to overlay over the existing PDF text which would hide it with the new text. You'd know the height and width of the watermark, and could calculate the starting position by analyzing the text as indicated above. Note that this is simple but relies on you leaving enough space in the original PDF for the watermark to fit while not covering the words on either side.
Craig Ransom
Tracker Software - Clarion Support
http://www.tracker-software.com

johanr
User
Posts: 14
Joined: Sun Sep 24, 2006 6:02 am

Post by johanr » Wed Mar 26, 2008 6:55 pm

Hi Craig

Thanks.

I found the AddLink function in the CW source files.

Can I call this directly after TextOut, to set up the url area for the newly created text string?
Where do I get more info on the parameters?
and what are the units for top,left,right,bottom?
Or even better is there a clarion example perhaps that might be doing something similiar?

I have a PDF template file and I am creating a new file with the data, and then overlaying to create one file.

thanks,

Johan

Tracker - Clarion Support
Site Admin
Posts: 1412
Joined: Wed Jun 30, 2004 4:45 pm
Location: Maryland, USA
Contact:

Post by Tracker - Clarion Support » Wed Mar 26, 2008 11:54 pm

Hi Johan!

You should be able to call AddLink after TextOut.

Measurements are always in points, i.e. 1/72 inch. Also, the vertical Y position is measured from the BOTTOM edge of the PDF page.

The PDF Overlay idea is a good one.
Craig Ransom
Tracker Software - Clarion Support
http://www.tracker-software.com

johanr
User
Posts: 14
Joined: Sun Sep 24, 2006 6:02 am

Post by johanr » Thu Mar 27, 2008 8:19 am

Hi Craig

Thanks for the info, that helps a lot, will let you know if I have further problems.

Do you have more info on the parametrs from piOpacity onwords?
Or if you can point me to the docs for this?

PDFManagerClass.AddLink
PROCEDURE(
LONG pPageNo,
STRING szURL,
REAL pLeft,
REAL pTop,
REAL pRight,
REAL pBottom,
LONG piOpacity, ??
COLORREF piColor, ??
LONG piFlags, ??
LONG pbWidth, ??
LONG pbType, ??
LONG pbDashCount, ??
LONG pbDashArray ??


My problem with search and replace is on hold and I will look into at a later stage, it is not crucial for the first version.
If there is something in newer releases that can help please let me know.

TIA

Johan

Tracker - Clarion Support
Site Admin
Posts: 1412
Joined: Wed Jun 30, 2004 4:45 pm
Location: Maryland, USA
Contact:

Post by Tracker - Clarion Support » Thu Mar 27, 2008 1:18 pm

Hi Johan!

The parameters for the AddLink method are a "flattened" version of the PXCp_AddLink parameters including the PXC_CommonAnnotInfo and PXC_AnnotBorder structures. Please check PDFLib30Help.chm for those topics for more detailed information.

Some suggested values to help you get going:

LONG piOpacity, 0=transparent to 255=opaque: 255
COLORREF piColor, Any of the standard Clarion COLOR: equates such as COLOR:Blue
LONG piFlags, AF_Print
LONG pbWidth, Width of the border in points: 2
LONG pbType, Try ABS_Underline, or ABS_Solid if the first doesn't work.
LONG pbDashCount, set to zero.
LONG pbDashArray, set to zero

The parameters for the AddLink method are a "flattened" version of the PXCp_AddLink parameters including the PXC_CommonAnnotInfo and PXC_AnnotBorder structures. Please check PDFLib30Help.chm for those topics for more detailed information.
Craig Ransom
Tracker Software - Clarion Support
http://www.tracker-software.com

Post Reply

Return to “PDF-Tools SDK (DLL Libraries Only) - Clarion For Windows Developers Only Please”