Tilman: Thanks for your quick response. I've upgraded to PDFBox 2.0.27, with the same results.
The PDF file can be downloaded here: https://s3.amazonaws.com/webdl.equorum.com/misc/size2013.pdf Thanks for any assistance. I'm going to start tracing thru Batik source code for the SVG error. Rich Stafford Chief Scientist eQuorum Corporation *** At 01:28 PM 1/5/2023, Tilman Hausherr wrote: >Hi, > >Please try with 2.0.27 and upload the PDF somewhere, it didn't get through. > >Tilman > >On 05.01.2023 16:28, Rich Stafford wrote: >>I am having an issue using PDFBox (pdfbox-app-2.0.21.jar) and SVGGraphics2d >>(batik-1ll-1.16.jar) to generate SVG output from a small PDF file. >> >>This file has about 9 vector lines, and a rectangle filled with horizontal >>lines. Using the PDFBox PDFRenderer to JPG, I get the appropriate fill for >>the rectangle: >> >>screen capture: >>Emacs! >> >> >>However, using the PDFBox PDFRenderer with SVGGraphics2d, I get a black >>filled rectangle. >> >>screen capture: >>Emacs! >> >> >>The generator code fragment is as follows: >> >>// setup instance of org.w3c.dom.Document >>DOMImplementation oDom = GenericDOMImplementation.getDOMImplementation(); >>String sSvgOrg = " http://www.w3.org/2000/svg" ; >>Document oSvgDoc = oDom .createDocument( sSvgOrg , "svg", null); >>SVGGeneratorContext oCtx = SVGGeneratorContext.createDefault( oSvgDoc ); >>oCtx .setEmbeddedFontsOn( true ); >> >>// setup renderer object >>PDFRenderer oRender = new PDFRenderer( oDoc ); >> >>// loop for all pages in the PDF >>for ( int nPageNdx = 0; nPageNdx < oDoc.getNumberOfPages(); nPageNdx++ ) >>{ >> // setup output file >> if ( sOutputMode .equalsIgnoreCase( "svg") ) >> { // svg >> String sSvgPageSpec = GenericUtil.PathMake( sDestPath , >> "page-"+ nPageNdx + ".svg"); >> ( new File( sSvgPageSpec )).createNewFile(); >> // setup instance of SVG Generator >> SVGGraphics2D oSvgGen = new SVGGraphics2D( oCtx, false ); >> // render the page to SVG >> oRender .renderPageToGraphics( nPageNdx, oSvgGen ); >> // write to file >> OutputStream oOutStream = new FileOutputStream( new File( >> sSvgPageSpec) ); >> Writer oOutWriter = new OutputStreamWriter( oOutStream, >> "UTF-8" ); >> oSvgGen .stream( oOutWriter, true ); >> continue ; >> } >> if ( sOutputMode .equalsIgnoreCase( "jpg") ) >> { // jpg output >> String sJpgPageSpec = GenericUtil.PathMake( sDestPath , >> "page-"+ nPageNdx + ".jpg"); >> File oFileJpg = new File( sJpgPageSpec); >> BufferedImage image = oRender .renderImageWithDPI( nPageNdx , >> GenericUtil.parseInt( sDpi , 300)); >>    ImageIO. write( image, "JPEG", oFileJpg); >> continue; >> } >>} >> >>I've attached the input PDF file as well. >> >>Thoughts? >> >>Rich Stafford >>Chief Scientist >>eQuorum Corporation >> >> >> >>--------------------------------------------------------------------- >>To unsubscribe, e-mail: >><mailto:users-unsubscr...@pdfbox.apache.org>users-unsubscr...@pdfbox.apache.org >>For additional commands, e-mail: >><mailto:users-h...@pdfbox.apache.org>users-h...@pdfbox.apache.org > > >