Home » U++ Library support » Draw, Display, Images, Bitmaps, Icons » PDF file from Report
Re: PDF file from Report [message #56424 is a reply to message #56414] |
Wed, 10 March 2021 09:25   |
mubeta
Messages: 77 Registered: October 2006
|
Member |
|
|
I solved it by changing some more code, generating the tuple key by the image hash. In this way the PDF file size decrease a lot, similar to using a PDF printer.
void PdfDraw::DrawImageOp(int x, int y, int cx, int cy, const Image& _img, const Rect& src, Color c)
{
Image img = _img;
if(!IsNull(c))
img = CachedSetColorKeepAlpha(img, c);
//Tuple2<int64, Rect> key = MakeTuple(img.GetSerialId(), src);
Tuple2<int64, Rect> key = MakeTuple(img.GetHashValue(), src);
int q = images.Find(key);
if(q < 0)
{
//q = images.GetCount();
//images.Add(key, img);
Image h = sJPEGDummy();
q = images.GetCount();
images.Add(key, h);
data = JPGEncoder(40).SaveString(img);
img = h;
}
if(img.GetSerialId() == sJPEGDummy().GetSerialId())
jpeg.Add(data);
page << "q "
<< Pt(cx) << " 0 0 " << Pt(cy) << ' '
<< Pt(x) << ' ' << Pt(pgsz.cy - y - cy)
<< " cm /Image" << q + 1 << " Do Q\n";
}
[Updated on: Wed, 10 March 2021 09:25] Report message to a moderator
|
|
|
Goto Forum:
Current Time: Sun Jun 01 17:35:26 CEST 2025
Total time taken to generate the page: 0.03203 seconds
|