You are viewing a plain text version of this content. The canonical link for it is here.
Posted to batik-users@xmlgraphics.apache.org by Lea Thurman <le...@onesoon.co.uk> on 2008/02/14 21:39:34 UTC

The URI can't be opened error: when generating PDF with embedded image

Hi,

I am new to batik so please be gentle.

I am getting the following error from the PDFTranscoder when I attempt to
convert an SVG (attached) with a single embedded bitmap.

The URI "bmpfile.bmp" on element <image> can't be opened because:
The URI can't be opened: Unable to make sense of URL for connection

The SVG is displayed correctly when I view it via squiggle.

http://www.nabble.com/file/p15488838/bmpfile.svg bmpfile.svg 

This maybe a silly question but does the PDFTranscoder support the image
tag? Assuming it does is it simple the fact that it cannot find the bitmap
file?

Any help is much appreciated.
Lea Thurman.
-- 
View this message in context: http://www.nabble.com/The-URI-can%27t-be-opened-error%3A-when-generating-PDF-with-embedded-image-tp15488838p15488838.html
Sent from the Batik - Users mailing list archive at Nabble.com.


---------------------------------------------------------------------
To unsubscribe, e-mail: batik-users-unsubscribe@xmlgraphics.apache.org
For additional commands, e-mail: batik-users-help@xmlgraphics.apache.org


Re: Produce multiple PDF pages (was: Re: The URI can't be opened error: when generating PDF with embedded image)

Posted by The Web Maestro <th...@gmail.com>.
Hi Lea,

I believe Jeremias just went offline for 10 days,  but Fop0.95beta was
released on March 26, 2008, so it may have what you need:

http://xmlgraphics.apache.org/fop/download.html

I'd recommend you give it a shot with the FO Jeremias posted. Once you
know it works, you should be able to come up with a way to auotmate
the process via XML+XSLT. If not, ask for more help here or on the XSL
Mulberry List...

Clay



On 5/18/08, Lea Thurman <le...@onesoon.co.uk> wrote:
>
> Sorry Jeremias,
>
> I know its been a while since you responded to this but I am now back on the
> case. - after an unwelcome diversion.
>
> Yes this is exactly what I need. I need the ability to render several SVG
> images to a multiple page PDF document.
>
> You spoke about a FOP trunk which could achieve this. Is this still needed
> given the delay in me responding?
>
> Also is there a way to dynamically generate the FOP document in code as I
> would not really want to generate an XML structure and then in turn
> transform this.
>
> As always any help is much appreciated.
>
> Regards
> Lea.
>
>
>
> Jeremias Maerki-2 wrote:
>>
>> The PDFTranscoder currently doesn't offer anything to produce multiple
>> PDF pages. However, the underlying PDFDocumentGraphics2D class does (but
>> it might not help you). Would you just want to convert a series of SVG
>> files to a single PDF?
>>
>> If that's the case, I can give you an alternative: FOP Trunk (i.e.
>> unreleased code from our SVN repo) can do exactly that using a
>> properietary extension to XSL-FO. You'd call FOP, not Batik, but Batik
>> is still used to process the SVG graphics. The FO file to glue all this
>> together would look like this:
>>
>>     <fo:root xmlns:fo="http://www.w3.org/1999/XSL/Format"
>>         xmlns:fox="http://xmlgraphics.apache.org/fop/extensions">
>>       <fo:layout-master-set>
>>         <fo:simple-page-master master-name="dummy" page-width="5in"
>> page-height="5in">
>>           <fo:region-body/>
>>         </fo:simple-page-master>
>>       </fo:layout-master-set>
>>       <fox:external-document id="img1" src="mysvgimage1.svg"/>
>>       <fox:external-document id="img2" src="mysvgimage2.svg"/>
>>       <fox:external-document id="img3" src="mysvgimage3.svg"/>
>>     </fo:root>
>>
>> Maybe that helps.
>>
>> On 18.02.2008 20:39:00 Lea Thurman wrote:
>> <snip/>
>>> Now all I need to do is get the PDF to produce pages? I know I am
>>> hijacking the thread the any pointers there given your other post?
>> <snip/>
>>
>>
>> Jeremias Maerki
>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: batik-users-unsubscribe@xmlgraphics.apache.org
>> For additional commands, e-mail: batik-users-help@xmlgraphics.apache.org
>>
>>
>>
>
> --
> View this message in context:
> http://www.nabble.com/The-URI-can%27t-be-opened-error%3A-when-generating-PDF-with-embedded-image-tp15488838p17307423.html
> Sent from the Batik - Users mailing list archive at Nabble.com.
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: batik-users-unsubscribe@xmlgraphics.apache.org
> For additional commands, e-mail: batik-users-help@xmlgraphics.apache.org
>
>

-- 
Sent from Gmail for mobile | mobile.google.com

Regards,

The Web Maestro
-- 
<th...@gmail.com> - <http://ourlil.com/>
My religion is simple. My religion is kindness.
- HH The 14th Dalai Lama of Tibet

---------------------------------------------------------------------
To unsubscribe, e-mail: batik-users-unsubscribe@xmlgraphics.apache.org
For additional commands, e-mail: batik-users-help@xmlgraphics.apache.org


Re: Produce multiple PDF pages (was: Re: The URI can't be opened error: when generating PDF with embedded image)

Posted by Lea Thurman <le...@onesoon.co.uk>.
Sorry Jeremias,

I know its been a while since you responded to this but I am now back on the
case. - after an unwelcome diversion.

Yes this is exactly what I need. I need the ability to render several SVG
images to a multiple page PDF document.

You spoke about a FOP trunk which could achieve this. Is this still needed
given the delay in me responding?

Also is there a way to dynamically generate the FOP document in code as I
would not really want to generate an XML structure and then in turn
transform this.

As always any help is much appreciated.

Regards
Lea.



Jeremias Maerki-2 wrote:
> 
> The PDFTranscoder currently doesn't offer anything to produce multiple
> PDF pages. However, the underlying PDFDocumentGraphics2D class does (but
> it might not help you). Would you just want to convert a series of SVG
> files to a single PDF?
> 
> If that's the case, I can give you an alternative: FOP Trunk (i.e.
> unreleased code from our SVN repo) can do exactly that using a
> properietary extension to XSL-FO. You'd call FOP, not Batik, but Batik
> is still used to process the SVG graphics. The FO file to glue all this
> together would look like this:
> 
>     <fo:root xmlns:fo="http://www.w3.org/1999/XSL/Format"
>         xmlns:fox="http://xmlgraphics.apache.org/fop/extensions">
>       <fo:layout-master-set>
>         <fo:simple-page-master master-name="dummy" page-width="5in"
> page-height="5in">
>           <fo:region-body/>
>         </fo:simple-page-master>
>       </fo:layout-master-set>
>       <fox:external-document id="img1" src="mysvgimage1.svg"/>
>       <fox:external-document id="img2" src="mysvgimage2.svg"/>
>       <fox:external-document id="img3" src="mysvgimage3.svg"/>
>     </fo:root>
> 
> Maybe that helps.
> 
> On 18.02.2008 20:39:00 Lea Thurman wrote:
> <snip/>
>> Now all I need to do is get the PDF to produce pages? I know I am  
>> hijacking the thread the any pointers there given your other post?
> <snip/>
> 
> 
> Jeremias Maerki
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: batik-users-unsubscribe@xmlgraphics.apache.org
> For additional commands, e-mail: batik-users-help@xmlgraphics.apache.org
> 
> 
> 

-- 
View this message in context: http://www.nabble.com/The-URI-can%27t-be-opened-error%3A-when-generating-PDF-with-embedded-image-tp15488838p17307423.html
Sent from the Batik - Users mailing list archive at Nabble.com.


---------------------------------------------------------------------
To unsubscribe, e-mail: batik-users-unsubscribe@xmlgraphics.apache.org
For additional commands, e-mail: batik-users-help@xmlgraphics.apache.org


Produce multiple PDF pages (was: Re: The URI can't be opened error: when generating PDF with embedded image)

Posted by Jeremias Maerki <de...@jeremias-maerki.ch>.
The PDFTranscoder currently doesn't offer anything to produce multiple
PDF pages. However, the underlying PDFDocumentGraphics2D class does (but
it might not help you). Would you just want to convert a series of SVG
files to a single PDF?

If that's the case, I can give you an alternative: FOP Trunk (i.e.
unreleased code from our SVN repo) can do exactly that using a
properietary extension to XSL-FO. You'd call FOP, not Batik, but Batik
is still used to process the SVG graphics. The FO file to glue all this
together would look like this:

    <fo:root xmlns:fo="http://www.w3.org/1999/XSL/Format"
        xmlns:fox="http://xmlgraphics.apache.org/fop/extensions">
      <fo:layout-master-set>
        <fo:simple-page-master master-name="dummy" page-width="5in" page-height="5in">
          <fo:region-body/>
        </fo:simple-page-master>
      </fo:layout-master-set>
      <fox:external-document id="img1" src="mysvgimage1.svg"/>
      <fox:external-document id="img2" src="mysvgimage2.svg"/>
      <fox:external-document id="img3" src="mysvgimage3.svg"/>
    </fo:root>

Maybe that helps.

On 18.02.2008 20:39:00 Lea Thurman wrote:
<snip/>
> Now all I need to do is get the PDF to produce pages? I know I am  
> hijacking the thread the any pointers there given your other post?
<snip/>


Jeremias Maerki


---------------------------------------------------------------------
To unsubscribe, e-mail: batik-users-unsubscribe@xmlgraphics.apache.org
For additional commands, e-mail: batik-users-help@xmlgraphics.apache.org


Re: The URI can't be opened error: when generating PDF with embedded image

Posted by Lea Thurman <le...@onesoon.co.uk>.
Jeremias,

Success - thanks for your help. I tried your suggestion and it too  
worked and led me to solve my problem. The output looks pretty  
impressive as well even with 15 pixel images.

FYI: My problem was 2 fold, firstly I was not
specifying the URL correctly (am working on a mac which confused me)  
but secondly even when specified correctly batik was still throwing an  
exception due to the fact that I had uncommented a line which logged  
errors when building the URL. On seeing this error I just assumed it  
had failed when it fact it had succeeded.

It is all working now even though batik throws the exception.

Now all I need to do is get the PDF to produce pages? I know I am  
hijacking the thread the any pointers there given your other post?

Thanks
Lea.


On 18 Feb 2008, at 18:26, Jeremias Maerki wrote:

> Sorry for the delay. I can produce PDF with JPEG images with no  
> problems
> in Batik 1.6 and 1.7. For example, I tried the following command-line:
>
> java -jar batik-rasterizer.jar -m application/pdf samples/tests/spec/ 
> painting/image-rendering.svg -d image-rendering.svg
>
> (from Batiks root directory, so you can try it on your side.)
>
> I don't know what's wrong on your side. Are you using a binary
> distribution? If yes, what version? Have you tried from the command- 
> line?
>
> On 15.02.2008 13:55:40 Lea Thurman wrote:
>>
>> Your right, squiggle is moaning but Safari and Opera are both able  
>> to render
>> the bitmap. Squiggle does render it correctly if I embed a JPG.
>>
>> I do have scope to convert to JPG but when I progress this route I  
>> get the
>> same error when rendering the PDF. I am not sure how to specify the  
>> URI for
>> the xlink:xref If I just specify the file name then it creates the  
>> correct
>> SVG but the PDFTranscoder cannot accept this.
>>
>> Has anyone managed to produce to a PDF with an embedded image? If  
>> so how did
>> you specify the xlink:href when constructing the SVG document?
>>
>> Many Thanks
>> Lea.
>>
>>
>>
>> Jeremias Maerki-2 wrote:
>>>
>>> Uhm, here it doesn't even work in Squiggle. AFAIK, Batik doesn't
>>> recognize BMP images at all, only JPEG, PNG and TIFF. What if you
>>> convert the BMP image to a PNG?
>>>
>>> On 14.02.2008 21:39:34 Lea Thurman wrote:
>>>>
>>>> Hi,
>>>>
>>>> I am new to batik so please be gentle.
>>>>
>>>> I am getting the following error from the PDFTranscoder when I  
>>>> attempt to
>>>> convert an SVG (attached) with a single embedded bitmap.
>>>>
>>>> The URI "bmpfile.bmp" on element <image> can't be opened because:
>>>> The URI can't be opened: Unable to make sense of URL for connection
>>>>
>>>> The SVG is displayed correctly when I view it via squiggle.
>>>>
>>>> http://www.nabble.com/file/p15488838/bmpfile.svg bmpfile.svg
>>>>
>>>> This maybe a silly question but does the PDFTranscoder support  
>>>> the image
>>>> tag? Assuming it does is it simple the fact that it cannot find the
>>>> bitmap
>>>> file?
>>>>
>>>> Any help is much appreciated.
>>>> Lea Thurman.
>>>> -- 
>>>> View this message in context:
>>>> http://www.nabble.com/The-URI-can%27t-be-opened-error%3A-when-generating-PDF-with-embedded-image-tp15488838p15488838.html
>>>> Sent from the Batik - Users mailing list archive at Nabble.com.
>>>>
>>>
>>>
>>> Jeremias Maerki
>>>
>>>
>>> ---------------------------------------------------------------------
>>> To unsubscribe, e-mail: batik-users-unsubscribe@xmlgraphics.apache.org
>>> For additional commands, e-mail: batik-users-help@xmlgraphics.apache.org
>>>
>>>
>>>
>>
>> -- 
>> View this message in context: http://www.nabble.com/The-URI-can%27t-be-opened-error%3A-when-generating-PDF-with-embedded-image-tp15488838p15500394.html
>> Sent from the Batik - Users mailing list archive at Nabble.com.
>
>
>
> Jeremias Maerki
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: batik-users-unsubscribe@xmlgraphics.apache.org
> For additional commands, e-mail: batik-users-help@xmlgraphics.apache.org
>

Lea Thurman
OneSoon Limited
22-24 Greenwood Street
Altrincham, WA14 1RZ

mob:   +44 (0) 7980 210 326
tel:      +44 (0) 8456 123 678
email:  lea.thurman@onesoon.co.uk
web:    www.onesoon.co.uk


---------------------------------------------------------------------
To unsubscribe, e-mail: batik-users-unsubscribe@xmlgraphics.apache.org
For additional commands, e-mail: batik-users-help@xmlgraphics.apache.org


Re: The URI can't be opened error: when generating PDF with embedded image

Posted by Jeremias Maerki <de...@jeremias-maerki.ch>.
Sorry for the delay. I can produce PDF with JPEG images with no problems
in Batik 1.6 and 1.7. For example, I tried the following command-line:

java -jar batik-rasterizer.jar -m application/pdf samples/tests/spec/painting/image-rendering.svg -d image-rendering.svg

(from Batiks root directory, so you can try it on your side.)

I don't know what's wrong on your side. Are you using a binary
distribution? If yes, what version? Have you tried from the command-line?

On 15.02.2008 13:55:40 Lea Thurman wrote:
> 
> Your right, squiggle is moaning but Safari and Opera are both able to render
> the bitmap. Squiggle does render it correctly if I embed a JPG.
> 
> I do have scope to convert to JPG but when I progress this route I get the
> same error when rendering the PDF. I am not sure how to specify the URI for
> the xlink:xref If I just specify the file name then it creates the correct
> SVG but the PDFTranscoder cannot accept this.
> 
> Has anyone managed to produce to a PDF with an embedded image? If so how did
> you specify the xlink:href when constructing the SVG document?
> 
> Many Thanks
> Lea.
> 
> 
> 
> Jeremias Maerki-2 wrote:
> > 
> > Uhm, here it doesn't even work in Squiggle. AFAIK, Batik doesn't
> > recognize BMP images at all, only JPEG, PNG and TIFF. What if you
> > convert the BMP image to a PNG?
> > 
> > On 14.02.2008 21:39:34 Lea Thurman wrote:
> >> 
> >> Hi,
> >> 
> >> I am new to batik so please be gentle.
> >> 
> >> I am getting the following error from the PDFTranscoder when I attempt to
> >> convert an SVG (attached) with a single embedded bitmap.
> >> 
> >> The URI "bmpfile.bmp" on element <image> can't be opened because:
> >> The URI can't be opened: Unable to make sense of URL for connection
> >> 
> >> The SVG is displayed correctly when I view it via squiggle.
> >> 
> >> http://www.nabble.com/file/p15488838/bmpfile.svg bmpfile.svg 
> >> 
> >> This maybe a silly question but does the PDFTranscoder support the image
> >> tag? Assuming it does is it simple the fact that it cannot find the
> >> bitmap
> >> file?
> >> 
> >> Any help is much appreciated.
> >> Lea Thurman.
> >> -- 
> >> View this message in context:
> >> http://www.nabble.com/The-URI-can%27t-be-opened-error%3A-when-generating-PDF-with-embedded-image-tp15488838p15488838.html
> >> Sent from the Batik - Users mailing list archive at Nabble.com.
> >> 
> > 
> > 
> > Jeremias Maerki
> > 
> > 
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: batik-users-unsubscribe@xmlgraphics.apache.org
> > For additional commands, e-mail: batik-users-help@xmlgraphics.apache.org
> > 
> > 
> > 
> 
> -- 
> View this message in context: http://www.nabble.com/The-URI-can%27t-be-opened-error%3A-when-generating-PDF-with-embedded-image-tp15488838p15500394.html
> Sent from the Batik - Users mailing list archive at Nabble.com.



Jeremias Maerki


---------------------------------------------------------------------
To unsubscribe, e-mail: batik-users-unsubscribe@xmlgraphics.apache.org
For additional commands, e-mail: batik-users-help@xmlgraphics.apache.org


Re: The URI can't be opened error: when generating PDF with embedded image

Posted by Lea Thurman <le...@onesoon.co.uk>.
Your right, squiggle is moaning but Safari and Opera are both able to render
the bitmap. Squiggle does render it correctly if I embed a JPG.

I do have scope to convert to JPG but when I progress this route I get the
same error when rendering the PDF. I am not sure how to specify the URI for
the xlink:xref If I just specify the file name then it creates the correct
SVG but the PDFTranscoder cannot accept this.

Has anyone managed to produce to a PDF with an embedded image? If so how did
you specify the xlink:href when constructing the SVG document?

Many Thanks
Lea.



Jeremias Maerki-2 wrote:
> 
> Uhm, here it doesn't even work in Squiggle. AFAIK, Batik doesn't
> recognize BMP images at all, only JPEG, PNG and TIFF. What if you
> convert the BMP image to a PNG?
> 
> On 14.02.2008 21:39:34 Lea Thurman wrote:
>> 
>> Hi,
>> 
>> I am new to batik so please be gentle.
>> 
>> I am getting the following error from the PDFTranscoder when I attempt to
>> convert an SVG (attached) with a single embedded bitmap.
>> 
>> The URI "bmpfile.bmp" on element <image> can't be opened because:
>> The URI can't be opened: Unable to make sense of URL for connection
>> 
>> The SVG is displayed correctly when I view it via squiggle.
>> 
>> http://www.nabble.com/file/p15488838/bmpfile.svg bmpfile.svg 
>> 
>> This maybe a silly question but does the PDFTranscoder support the image
>> tag? Assuming it does is it simple the fact that it cannot find the
>> bitmap
>> file?
>> 
>> Any help is much appreciated.
>> Lea Thurman.
>> -- 
>> View this message in context:
>> http://www.nabble.com/The-URI-can%27t-be-opened-error%3A-when-generating-PDF-with-embedded-image-tp15488838p15488838.html
>> Sent from the Batik - Users mailing list archive at Nabble.com.
>> 
> 
> 
> Jeremias Maerki
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: batik-users-unsubscribe@xmlgraphics.apache.org
> For additional commands, e-mail: batik-users-help@xmlgraphics.apache.org
> 
> 
> 

-- 
View this message in context: http://www.nabble.com/The-URI-can%27t-be-opened-error%3A-when-generating-PDF-with-embedded-image-tp15488838p15500394.html
Sent from the Batik - Users mailing list archive at Nabble.com.


---------------------------------------------------------------------
To unsubscribe, e-mail: batik-users-unsubscribe@xmlgraphics.apache.org
For additional commands, e-mail: batik-users-help@xmlgraphics.apache.org


Re: The URI can't be opened error: when generating PDF with embedded image

Posted by Jeremias Maerki <de...@jeremias-maerki.ch>.
Uhm, here it doesn't even work in Squiggle. AFAIK, Batik doesn't
recognize BMP images at all, only JPEG, PNG and TIFF. What if you
convert the BMP image to a PNG?

On 14.02.2008 21:39:34 Lea Thurman wrote:
> 
> Hi,
> 
> I am new to batik so please be gentle.
> 
> I am getting the following error from the PDFTranscoder when I attempt to
> convert an SVG (attached) with a single embedded bitmap.
> 
> The URI "bmpfile.bmp" on element <image> can't be opened because:
> The URI can't be opened: Unable to make sense of URL for connection
> 
> The SVG is displayed correctly when I view it via squiggle.
> 
> http://www.nabble.com/file/p15488838/bmpfile.svg bmpfile.svg 
> 
> This maybe a silly question but does the PDFTranscoder support the image
> tag? Assuming it does is it simple the fact that it cannot find the bitmap
> file?
> 
> Any help is much appreciated.
> Lea Thurman.
> -- 
> View this message in context: http://www.nabble.com/The-URI-can%27t-be-opened-error%3A-when-generating-PDF-with-embedded-image-tp15488838p15488838.html
> Sent from the Batik - Users mailing list archive at Nabble.com.
> 


Jeremias Maerki


---------------------------------------------------------------------
To unsubscribe, e-mail: batik-users-unsubscribe@xmlgraphics.apache.org
For additional commands, e-mail: batik-users-help@xmlgraphics.apache.org