David PHAM-VAN

Fix Windows print margins

... ... @@ -3,6 +3,7 @@
## 5.6.2
- Fix Windows string encoding
- Fix Windows print margins
## 5.6.2
... ...
... ... @@ -287,7 +287,8 @@ void print_job::raster_pdf(const uint8_t data[],
auto bitmap = FPDFBitmap_Create(bWidth, bHeight, 0);
FPDFBitmap_FillRect(bitmap, 0, 0, bWidth, bHeight, 0xffffffff);
FPDF_RenderPageBitmap(bitmap, page, 0, 0, bWidth, bHeight, 0, FPDF_ANNOT);
FPDF_RenderPageBitmap(bitmap, page, 0, 0, bWidth, bHeight, 0,
FPDF_ANNOT | FPDF_LCD_TEXT | FPDF_NO_NATIVETEXT);
uint8_t* p = static_cast<uint8_t*>(FPDFBitmap_GetBuffer(bitmap));
auto stride = FPDFBitmap_GetStride(bitmap);
... ...
... ... @@ -218,6 +218,8 @@ void PrintJob::writeJob(std::vector<uint8_t> data) {
}
auto pages = FPDF_GetPageCount(doc);
auto marginLeft = GetDeviceCaps(hDC, PHYSICALOFFSETX);
auto marginTop = GetDeviceCaps(hDC, PHYSICALOFFSETY);
for (auto pageNum = 0; pageNum < pages; pageNum++) {
r = StartPage(hDC);
... ... @@ -234,7 +236,8 @@ void PrintJob::writeJob(std::vector<uint8_t> data) {
int bWidth = static_cast<int>(pdfWidth * dpiX);
int bHeight = static_cast<int>(pdfHeight * dpiY);
FPDF_RenderPage(hDC, page, 0, 0, bWidth, bHeight, 0, FPDF_ANNOT);
FPDF_RenderPage(hDC, page, -marginLeft, -marginTop, bWidth, bHeight, 0,
FPDF_ANNOT | FPDF_PRINTING);
FPDF_ClosePage(page);
r = EndPage(hDC);
}
... ...