Write higher resolution (DPI) Images to PDF -
i have seen code extract images based on image dpi using pdfbox below
pddocument document = pddocument.load(path); pdfimagewriter writer = new pdfimagewriter(); boolean success = writer.writeimage(document, "jpg", "", 1, 1, "c:\\image quality\\150", bufferedimage.type_int_rgb, 150); return document;
in above code can specify image resolution(150) while extracting image pdf. higher resolution larger image in return.
now want reverse of means specify resolution/dpi of image while writing image pdf, following code not providing such options specify dpi ? can guide me missing
pdpagecontentstream contentstream = null; contentstream = new pdpagecontentstream(document, userpage); contentstream.drawimage(img, 60, 60); contentstream.close();
please guide me can pass parameter of resolution/dpi (as image larger pdf page size) while writing image pdf ?
thanks,
you have been told in answer previous question dpi hardly has meaning in context of pdf.
that been said, tough, can achieve objective using method pdpagecontentstream.drawxobject(pdxobject xobject, float x, float y, float width, float height)
resizing (i.e. downsampling) image in original form , using drawimage embeds downsampled image.
using drawxobject on other hand embeds original image , scales it. thus, @ high resolution print-out former supplies downsampled, less resolved image while latter allows higher resolved image output.
Comments
Post a Comment