805 Pix *pix = api->GetInputImage();
806 const char *filename = api->GetInputName();
807 int ppi = api->GetSourceYResolution();
808 if (!pix || ppi <= 0) {
811 double width = pixGetWidth(pix) * 72.0 / ppi;
812 double height = pixGetHeight(pix) * 72.0 / ppi;
814 std::stringstream xobject;
816 xobject.imbue(std::locale::classic());
818 xobject <<
"/XObject << /Im1 " << (obj_ + 2) <<
" 0 R >>\n";
822 std::stringstream stream;
824 stream.imbue(std::locale::classic());
826 stream << std::fixed << obj_
832 << width <<
" " << height
841 " /ProcSet [ /PDF /Text /ImageB /ImageI /ImageC ]\n"
842 " /Font << /f-0-0 3 0 R >>\n"
846 pages_.push_back(obj_);
847 AppendPDFObject(stream.str().c_str());
850 const std::unique_ptr<char[]> pdftext(GetPDFTextObjects(api, width, height));
851 const size_t pdftext_len = strlen(pdftext.get());
853 unsigned char *comp_pdftext =
854 zlibCompress(
reinterpret_cast<unsigned char *
>(pdftext.get()), pdftext_len, &len);
855 long comp_pdftext_len = len;
862 <<
" /Filter /FlateDecode\n"
866 long objsize = stream.str().size();
867 AppendData(
reinterpret_cast<char *
>(comp_pdftext), comp_pdftext_len);
868 objsize += comp_pdftext_len;
869 lept_free(comp_pdftext);
874 objsize += strlen(b2);
875 AppendPDFObjectDIY(objsize);
878 char *pdf_object =
nullptr;
880 api->GetIntVariable(
"jpg_quality", &jpg_quality);
881 if (!imageToPDFObj(pix, filename, obj_, &pdf_object, &objsize, jpg_quality)) {
885 AppendPDFObjectDIY(objsize);
void AppendString(const char *s)
void AppendData(const char *s, int len)