You are not logged in.

#1 2017-04-04 15:09:54

Platt
Member
Registered: 2017-04-04
Posts: 2

Replace hyperlinks with Infix Server (-pdfspool)

Hello,

we need to replace many different hyperlinks in lots of PDF files.

I can replace different hyperlinks in one file with something like that (running "infixserver -c default.cfg -d ExampleXMLCommandFiles\ReplaceHyperlinks_umlaut"):

<?xml version="1.0" encoding="UTF-8"?>
<InfixServer>
	<Input>
		<File>ExampleXMLCommandFiles/_TestLink.pdf</File>
	</Input>
	<Commands>
		<Command Name="Replace Hyperlinks">
			<WholeWords>false</WholeWords>
			<MatchCase>false</MatchCase>
			<UseWildcards>false</UseWildcards>
			<Replace>
			<From>
			<Text>C:/Temp/CärAd.pdf</Text>
			</From>
			<To>
			<Text>C:/Temp2/sizetotext.pdf</Text>
			</To>
			</Replace>
			<StartPage>1</StartPage>
			<EndPage>LastPage</EndPage>
			<RestrictTo> All</RestrictTo>
		</Command>

		<Command Name="Replace Hyperlinks">
			<WholeWords>false</WholeWords>
			<MatchCase>false</MatchCase>
			<UseWildcards>false</UseWildcards>
			<Replace>
			<From>
			<Text>C:/Temp/crop.pdf</Text>
			</From>
			<To>
			<Text>C:/Temp2/CärAd.pdf</Text>
			</To>
			</Replace>
			<StartPage>1</StartPage>
			<EndPage>LastPage</EndPage>
			<RestrictTo> All</RestrictTo>
		</Command>
	</Commands>
	<Output>
		<File>ExampleXMLCommandFiles/_TestLinks_ümläüt_out.pdf</File>
	</Output>
</InfixServer>

I guess that's the way it should be done, because i had no luck with multiple <From>/<To> or <Replace>.

I then tried to do it with -pdfspool to replace in multiple files.

I removed the <Input> and <Output> tags, copied three PDF files to the Input folder and started with "infixserver -c default.cfg -d ExampleXMLCommandFiles\ReplaceHyperlinks_umlaut_batch.xml -pdfspool"

My default.cfg:

ICENI PREFS
OWNER:InfixServer
VERSION:310

[SPOOLER]
Input Dir =Input;
Output Dir =Output;
Error Dir =Error;
Completed Dir =Completed;
Filter =*.xml;
Helios dt =;
Error Halt =false;
Keep Log =true;
Batch Mode =true;
Poll rate =10;
Stable time =1;
[-- END --]

[Settings]
Log File =log.txt;
Max. Log Size (kB) =100000;
Log Trunc. Size (kB) =16;
Default Font Name =;
Built in Fonts Dir =fonts;
System Font Path =C:/Windows/Fonts;
Do Underlining =false;
Write Per File Results =true;
Detect Bold Text =false;
Do Tabs =true;
Ignore Text Clips =false;
Do Bullets =true;
CMaps Path =cmaps;
Unifont Path =unimaps/unifont;
Max Pages Per Block =200;
New Document Path =New Document.pdf;
Key Functions =All;
CMYK Profile =profiles/USWebCoatedSWOP.icc;
Hyphenation Dict =hyphenation/hyph-de-1996.tex;
Translation Config =transXML.cfg;
Field Config =fieldXML.cfg;
Stamp Pdf =Stamp.pdf;
System Font Cache =fontcache;
Convert DLL =;
[-- END --]

The output i get:

04/04/17 16:53:04: Started infixserver -c default.cfg -d Input\ReplaceHyperlinks
_umlaut.xml -pdfspool
04/04/17 16:53:04: License key not supplied. Running in demo mode
04/04/17 16:53:04: Writing HostID.txt. Please send this file to Iceni to obtain
a license key
04/04/17 16:53:05: Starting spooling from 'Input'
<?xml version="1.0" encoding="UTF-8"?>
<InfixServerResults>
        <Args>
                <Status>OK</Status>
        </Args>
        <Config>
                <Status>OK</Status>
        </Config>
        <LogFile>
                <Status>OK</Status>
        </LogFile>
        <LicenseKey>
                <Status>Warning</Status>
                <Detail Code="4">License key not supplied. Running in demo mode<
/Detail>
        </LicenseKey>
        <RunwayInit>
                <Status>OK</Status>
        </RunwayInit>
        <FontPaths>
                <Status>OK</Status>
        </FontPaths>
        <Spooler>
                <Status>OK</Status>
        </Spooler>
</InfixServerResults>
04/04/17 16:53:05: Spooler Started =============
04/04/17 16:53:05:
04/04/17 16:53:05: Completed

Then the .exe crashes.

With just the same single file in the Input directory that worked in single file mode the program is crashing, too.
The .xml gets copied to the Error directory.
In the log.txt there is nothing more.

Am i using it wrongly? With not having a -d parameter and having the .xml in the Input directory i get:

04/04/17 16:58:31: Started infixserver -c default.cfg -pdfspool
04/04/17 16:58:31: License key not supplied. Running in demo mode
04/04/17 16:58:31: Writing HostID.txt. Please send this file to Iceni to obtain
a license key
04/04/17 16:58:32: Starting spooling from 'Input'
<InfixServerResults>
        <Args>
                <Status>OK</Status>
        </Args>
        <Config>
                <Status>OK</Status>
        </Config>
        <LogFile>
                <Status>OK</Status>
        </LogFile>
        <LicenseKey>
                <Status>Warning</Status>
                <Detail Code="4">License key not supplied. Running in demo mode<
/Detail>
        </LicenseKey>
        <RunwayInit>
                <Status>OK</Status>
        </RunwayInit>
        <FontPaths>
                <Status>OK</Status>
        </FontPaths>
        <Spooler>
                <Status>OK</Status>
        </Spooler>
</InfixServerResults>
04/04/17 16:58:32: Spooler Started =============
04/04/17 16:58:32: Collected 1 files in batch
04/04/17 16:58:32: 1 files remain to be processed
04/04/17 16:58:32: Found 'Input\ReplaceHyperlinks_umlaut_batch.xml'
04/04/17 16:58:33: Processing

Then it just hangs there.

Other related question(s): i am only replacing hyperlinks' targets with that. If i change the text (second run with replace text command), too, and let's assume a short hyperlink text with a longer one. The worst thing that could happen is that it overlaps with different text? Or would the "textbox area" not change and it would be cropped. It surely would not change the position of other objects so other hyperlink areas would not still be over their original textareas, right?
Is there a best practice?


Thanks in advance for every help.
I hope this will be the right tool for us.

Greetings

Offline

#2 2017-04-05 09:46:54

scrowfoot
Moderator
From: Norwich
Registered: 2013-01-25
Posts: 89

Re: Replace hyperlinks with Infix Server (-pdfspool)

Please make a copy of default.cfg. Edit that copy and change

Filter =*.xml;

to

Filter =*.pdf;

It should work now if you run

infixserver -c pdfspool.cfg -d Input\ReplaceHyperlinks
_umlaut.xml -pdfspool

Where pdfspool.cfg is the edited version of default.cfg

Thanks, Simon.

Offline

#3 2017-04-18 12:55:36

Platt
Member
Registered: 2017-04-04
Posts: 2

Re: Replace hyperlinks with Infix Server (-pdfspool)

Thank you very much. That worked and the first test results are satisfying.

Is there a possibility to check how many pages (for pay as you go) or at least how many files would be edited before going through with it?
To get a rough estimate.

Thanks in advance!

Offline

Board footer

Powered by FluxBB