2025-06-28 17:40:42 +02:00
|
|
|
/*
|
|
|
|
|
* File: PixelToPdfWriter.h
|
|
|
|
|
* Author: Saleem Edah-Tally - nmset@yandex.com
|
|
|
|
|
* License : CeCILL-C
|
|
|
|
|
* Copyright Saleem Edah-Tally - © 2025
|
|
|
|
|
*
|
|
|
|
|
* Created on 14 06 2025, 17:15
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
#ifndef PIXELTOPDFWRITER_H
|
|
|
|
|
#define PIXELTOPDFWRITER_H
|
|
|
|
|
|
|
|
|
|
#include <string>
|
|
|
|
|
#include <map>
|
2025-07-01 22:38:07 +02:00
|
|
|
#include <vector>
|
2025-06-28 17:40:42 +02:00
|
|
|
#include <podofo/podofo.h>
|
2025-07-01 22:38:07 +02:00
|
|
|
#include <wx/wx.h>
|
|
|
|
|
|
|
|
|
|
struct StampDescriptor;
|
2025-06-28 17:40:42 +02:00
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Create a PDF document, append or insert pages from raw scanned files.\n
|
|
|
|
|
* Each image is a full page scan; it is scaled in the PDF document to the full
|
|
|
|
|
* page dimensions.\n
|
2025-07-01 22:38:07 +02:00
|
|
|
* Account for page size.\n
|
|
|
|
|
* Optionally, a stamp image may be blended on the page.
|
2025-06-28 17:40:42 +02:00
|
|
|
*/
|
|
|
|
|
class PixelToPdfWriter
|
|
|
|
|
{
|
|
|
|
|
public:
|
|
|
|
|
typedef std::map<std::string, PoDoFo::PdfPageSize> PageSizeMap;
|
|
|
|
|
|
|
|
|
|
PixelToPdfWriter();
|
|
|
|
|
bool AddPageAt(const std::string& pixelFile, uint width, uint height, uint index,
|
2025-07-01 22:38:07 +02:00
|
|
|
std::vector<StampDescriptor*> * descriptors,
|
2025-06-28 17:40:42 +02:00
|
|
|
PoDoFo::PdfPageSize pageSize = PoDoFo::PdfPageSize::A4,
|
|
|
|
|
PoDoFo::PdfColorSpace = PoDoFo::PdfColorSpace::DeviceRGB /*Unused*/);
|
|
|
|
|
void Save(const std::string& pdfFile);
|
|
|
|
|
uint GetNumberOfPages() const;
|
|
|
|
|
void RemovePageAt(uint index);
|
|
|
|
|
PoDoFo::PdfPageSize GetPageSize(const std::string& literal)
|
|
|
|
|
{
|
|
|
|
|
return m_pageSizes[literal]; // 0 if not found, PdfPageSize::Unknown.
|
|
|
|
|
}
|
|
|
|
|
PageSizeMap GetPageSizes() const
|
|
|
|
|
{
|
|
|
|
|
return m_pageSizes;
|
|
|
|
|
}
|
|
|
|
|
private:
|
|
|
|
|
PoDoFo::PdfMemDocument m_doc;
|
|
|
|
|
|
|
|
|
|
PageSizeMap m_pageSizes;
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
#endif // PIXELTOPDFWRITER_H
|