798 Pix *pix = api->GetInputImage();
799 const char* filename = api->GetInputName();
800 int ppi = api->GetSourceYResolution();
801 if (!pix || ppi <= 0)
803 double width = pixGetWidth(pix) * 72.0 / ppi;
804 double height = pixGetHeight(pix) * 72.0 / ppi;
806 std::stringstream xobject;
808 xobject.imbue(std::locale::classic());
810 xobject <<
"/XObject << /Im1 " << (obj_ + 2) <<
" 0 R >>\n";
814 std::stringstream stream;
816 stream.imbue(std::locale::classic());
818 stream << std::fixed <<
823 " /MediaBox [0 0 " << width <<
" " << height <<
"]\n"
824 " /Contents " << (obj_ + 1) <<
" 0 R\n"
827 " " << xobject.str() <<
828 " /ProcSet [ /PDF /Text /ImageB /ImageI /ImageC ]\n"
829 " /Font << /f-0-0 3 0 R >>\n"
834 AppendPDFObject(stream.str().c_str());
837 const std::unique_ptr<char[]> pdftext(GetPDFTextObjects(api, width, height));
838 const size_t pdftext_len = strlen(pdftext.get());
840 unsigned char *comp_pdftext = zlibCompress(
841 reinterpret_cast<unsigned char *
>(pdftext.get()), pdftext_len, &len);
842 long comp_pdftext_len = len;
847 " /Length " << comp_pdftext_len <<
" /Filter /FlateDecode\n"
851 long objsize = stream.str().size();
852 AppendData(
reinterpret_cast<char *
>(comp_pdftext), comp_pdftext_len);
853 objsize += comp_pdftext_len;
854 lept_free(comp_pdftext);
859 objsize += strlen(b2);
860 AppendPDFObjectDIY(objsize);
863 char *pdf_object =
nullptr;
865 api->GetIntVariable(
"jpg_quality", &jpg_quality);
866 if (!imageToPDFObj(pix, filename, obj_, &pdf_object, &objsize,
871 AppendPDFObjectDIY(objsize);