2024-08-25 04:08:24 +00:00
|
|
|
package qt
|
|
|
|
|
|
|
|
/*
|
|
|
|
|
|
|
|
#include "gen_qpdfwriter.h"
|
|
|
|
#include <stdlib.h>
|
|
|
|
|
|
|
|
*/
|
|
|
|
import "C"
|
|
|
|
|
|
|
|
import (
|
2024-10-16 05:07:56 +00:00
|
|
|
"github.com/mappu/miqt/libmiqt"
|
2024-08-25 04:08:24 +00:00
|
|
|
"runtime"
|
|
|
|
"unsafe"
|
|
|
|
)
|
|
|
|
|
|
|
|
type QPdfWriter struct {
|
|
|
|
h *C.QPdfWriter
|
|
|
|
*QObject
|
|
|
|
*QPagedPaintDevice
|
|
|
|
}
|
|
|
|
|
|
|
|
func (this *QPdfWriter) cPointer() *C.QPdfWriter {
|
|
|
|
if this == nil {
|
|
|
|
return nil
|
|
|
|
}
|
|
|
|
return this.h
|
|
|
|
}
|
|
|
|
|
2024-10-16 05:07:56 +00:00
|
|
|
func (this *QPdfWriter) UnsafePointer() unsafe.Pointer {
|
|
|
|
if this == nil {
|
|
|
|
return nil
|
|
|
|
}
|
|
|
|
return unsafe.Pointer(this.h)
|
|
|
|
}
|
|
|
|
|
2024-08-25 04:08:24 +00:00
|
|
|
func newQPdfWriter(h *C.QPdfWriter) *QPdfWriter {
|
2024-09-01 02:23:55 +00:00
|
|
|
if h == nil {
|
|
|
|
return nil
|
|
|
|
}
|
2024-10-16 05:07:56 +00:00
|
|
|
return &QPdfWriter{h: h, QObject: UnsafeNewQObject(unsafe.Pointer(h)), QPagedPaintDevice: UnsafeNewQPagedPaintDevice(unsafe.Pointer(h))}
|
2024-08-25 04:08:24 +00:00
|
|
|
}
|
|
|
|
|
2024-10-16 05:07:56 +00:00
|
|
|
func UnsafeNewQPdfWriter(h unsafe.Pointer) *QPdfWriter {
|
2024-08-25 04:08:24 +00:00
|
|
|
return newQPdfWriter((*C.QPdfWriter)(h))
|
|
|
|
}
|
|
|
|
|
|
|
|
// NewQPdfWriter constructs a new QPdfWriter object.
|
|
|
|
func NewQPdfWriter(filename string) *QPdfWriter {
|
2024-10-16 05:07:56 +00:00
|
|
|
filename_ms := libmiqt.Strdupg(filename)
|
2024-09-14 22:29:05 +00:00
|
|
|
defer C.free(filename_ms)
|
|
|
|
ret := C.QPdfWriter_new((*C.struct_miqt_string)(filename_ms))
|
2024-08-25 04:08:24 +00:00
|
|
|
return newQPdfWriter(ret)
|
|
|
|
}
|
|
|
|
|
|
|
|
// NewQPdfWriter2 constructs a new QPdfWriter object.
|
|
|
|
func NewQPdfWriter2(device *QIODevice) *QPdfWriter {
|
|
|
|
ret := C.QPdfWriter_new2(device.cPointer())
|
|
|
|
return newQPdfWriter(ret)
|
|
|
|
}
|
|
|
|
|
|
|
|
func (this *QPdfWriter) MetaObject() *QMetaObject {
|
2024-10-16 05:07:56 +00:00
|
|
|
return UnsafeNewQMetaObject(unsafe.Pointer(C.QPdfWriter_MetaObject(this.h)))
|
2024-08-25 04:08:24 +00:00
|
|
|
}
|
|
|
|
|
2024-09-20 22:32:57 +00:00
|
|
|
func (this *QPdfWriter) Metacast(param1 string) unsafe.Pointer {
|
|
|
|
param1_Cstring := C.CString(param1)
|
|
|
|
defer C.free(unsafe.Pointer(param1_Cstring))
|
|
|
|
return C.QPdfWriter_Metacast(this.h, param1_Cstring)
|
|
|
|
}
|
|
|
|
|
2024-08-25 04:08:24 +00:00
|
|
|
func QPdfWriter_Tr(s string) string {
|
|
|
|
s_Cstring := C.CString(s)
|
|
|
|
defer C.free(unsafe.Pointer(s_Cstring))
|
2024-09-14 22:29:05 +00:00
|
|
|
var _ms *C.struct_miqt_string = C.QPdfWriter_Tr(s_Cstring)
|
|
|
|
_ret := C.GoStringN(&_ms.data, C.int(int64(_ms.len)))
|
|
|
|
C.free(unsafe.Pointer(_ms))
|
|
|
|
return _ret
|
2024-08-25 04:08:24 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
func QPdfWriter_TrUtf8(s string) string {
|
|
|
|
s_Cstring := C.CString(s)
|
|
|
|
defer C.free(unsafe.Pointer(s_Cstring))
|
2024-09-14 22:29:05 +00:00
|
|
|
var _ms *C.struct_miqt_string = C.QPdfWriter_TrUtf8(s_Cstring)
|
|
|
|
_ret := C.GoStringN(&_ms.data, C.int(int64(_ms.len)))
|
|
|
|
C.free(unsafe.Pointer(_ms))
|
|
|
|
return _ret
|
2024-08-25 04:08:24 +00:00
|
|
|
}
|
|
|
|
|
2024-09-04 06:54:22 +00:00
|
|
|
func (this *QPdfWriter) SetPdfVersion(version QPagedPaintDevice__PdfVersion) {
|
2024-09-18 00:12:02 +00:00
|
|
|
C.QPdfWriter_SetPdfVersion(this.h, (C.int)(version))
|
2024-08-29 07:01:51 +00:00
|
|
|
}
|
|
|
|
|
2024-09-04 06:54:22 +00:00
|
|
|
func (this *QPdfWriter) PdfVersion() QPagedPaintDevice__PdfVersion {
|
2024-09-17 07:30:27 +00:00
|
|
|
return (QPagedPaintDevice__PdfVersion)(C.QPdfWriter_PdfVersion(this.h))
|
2024-08-29 07:01:51 +00:00
|
|
|
}
|
|
|
|
|
2024-08-25 04:08:24 +00:00
|
|
|
func (this *QPdfWriter) Title() string {
|
2024-09-14 22:29:05 +00:00
|
|
|
var _ms *C.struct_miqt_string = C.QPdfWriter_Title(this.h)
|
|
|
|
_ret := C.GoStringN(&_ms.data, C.int(int64(_ms.len)))
|
|
|
|
C.free(unsafe.Pointer(_ms))
|
|
|
|
return _ret
|
2024-08-25 04:08:24 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
func (this *QPdfWriter) SetTitle(title string) {
|
2024-10-16 05:07:56 +00:00
|
|
|
title_ms := libmiqt.Strdupg(title)
|
2024-09-14 22:29:05 +00:00
|
|
|
defer C.free(title_ms)
|
|
|
|
C.QPdfWriter_SetTitle(this.h, (*C.struct_miqt_string)(title_ms))
|
2024-08-25 04:08:24 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
func (this *QPdfWriter) Creator() string {
|
2024-09-14 22:29:05 +00:00
|
|
|
var _ms *C.struct_miqt_string = C.QPdfWriter_Creator(this.h)
|
|
|
|
_ret := C.GoStringN(&_ms.data, C.int(int64(_ms.len)))
|
|
|
|
C.free(unsafe.Pointer(_ms))
|
|
|
|
return _ret
|
2024-08-25 04:08:24 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
func (this *QPdfWriter) SetCreator(creator string) {
|
2024-10-16 05:07:56 +00:00
|
|
|
creator_ms := libmiqt.Strdupg(creator)
|
2024-09-14 22:29:05 +00:00
|
|
|
defer C.free(creator_ms)
|
|
|
|
C.QPdfWriter_SetCreator(this.h, (*C.struct_miqt_string)(creator_ms))
|
2024-08-25 04:08:24 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
func (this *QPdfWriter) NewPage() bool {
|
2024-09-17 07:30:27 +00:00
|
|
|
return (bool)(C.QPdfWriter_NewPage(this.h))
|
2024-08-25 04:08:24 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
func (this *QPdfWriter) SetResolution(resolution int) {
|
|
|
|
C.QPdfWriter_SetResolution(this.h, (C.int)(resolution))
|
|
|
|
}
|
|
|
|
|
|
|
|
func (this *QPdfWriter) Resolution() int {
|
2024-09-17 07:30:27 +00:00
|
|
|
return (int)(C.QPdfWriter_Resolution(this.h))
|
2024-08-25 04:08:24 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
func (this *QPdfWriter) SetDocumentXmpMetadata(xmpMetadata *QByteArray) {
|
|
|
|
C.QPdfWriter_SetDocumentXmpMetadata(this.h, xmpMetadata.cPointer())
|
|
|
|
}
|
|
|
|
|
|
|
|
func (this *QPdfWriter) DocumentXmpMetadata() *QByteArray {
|
2024-09-14 22:29:05 +00:00
|
|
|
_ret := C.QPdfWriter_DocumentXmpMetadata(this.h)
|
|
|
|
_goptr := newQByteArray(_ret)
|
|
|
|
_goptr.GoGC() // Qt uses pass-by-value semantics for this type. Mimic with finalizer
|
|
|
|
return _goptr
|
2024-08-25 04:08:24 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
func (this *QPdfWriter) AddFileAttachment(fileName string, data *QByteArray) {
|
2024-10-16 05:07:56 +00:00
|
|
|
fileName_ms := libmiqt.Strdupg(fileName)
|
2024-09-14 22:29:05 +00:00
|
|
|
defer C.free(fileName_ms)
|
|
|
|
C.QPdfWriter_AddFileAttachment(this.h, (*C.struct_miqt_string)(fileName_ms), data.cPointer())
|
2024-08-25 04:08:24 +00:00
|
|
|
}
|
|
|
|
|
2024-09-04 06:54:22 +00:00
|
|
|
func (this *QPdfWriter) SetPageSize(size QPagedPaintDevice__PageSize) {
|
2024-09-18 00:12:02 +00:00
|
|
|
C.QPdfWriter_SetPageSize(this.h, (C.int)(size))
|
2024-08-29 07:01:51 +00:00
|
|
|
}
|
|
|
|
|
2024-08-25 04:08:24 +00:00
|
|
|
func (this *QPdfWriter) SetPageSizeMM(size *QSizeF) {
|
|
|
|
C.QPdfWriter_SetPageSizeMM(this.h, size.cPointer())
|
|
|
|
}
|
|
|
|
|
2024-08-29 07:01:51 +00:00
|
|
|
func (this *QPdfWriter) SetMargins(m *QPagedPaintDevice__Margins) {
|
|
|
|
C.QPdfWriter_SetMargins(this.h, m.cPointer())
|
|
|
|
}
|
|
|
|
|
2024-08-25 04:08:24 +00:00
|
|
|
func QPdfWriter_Tr2(s string, c string) string {
|
|
|
|
s_Cstring := C.CString(s)
|
|
|
|
defer C.free(unsafe.Pointer(s_Cstring))
|
|
|
|
c_Cstring := C.CString(c)
|
|
|
|
defer C.free(unsafe.Pointer(c_Cstring))
|
2024-09-14 22:29:05 +00:00
|
|
|
var _ms *C.struct_miqt_string = C.QPdfWriter_Tr2(s_Cstring, c_Cstring)
|
|
|
|
_ret := C.GoStringN(&_ms.data, C.int(int64(_ms.len)))
|
|
|
|
C.free(unsafe.Pointer(_ms))
|
|
|
|
return _ret
|
2024-08-25 04:08:24 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
func QPdfWriter_Tr3(s string, c string, n int) string {
|
|
|
|
s_Cstring := C.CString(s)
|
|
|
|
defer C.free(unsafe.Pointer(s_Cstring))
|
|
|
|
c_Cstring := C.CString(c)
|
|
|
|
defer C.free(unsafe.Pointer(c_Cstring))
|
2024-09-14 22:29:05 +00:00
|
|
|
var _ms *C.struct_miqt_string = C.QPdfWriter_Tr3(s_Cstring, c_Cstring, (C.int)(n))
|
|
|
|
_ret := C.GoStringN(&_ms.data, C.int(int64(_ms.len)))
|
|
|
|
C.free(unsafe.Pointer(_ms))
|
|
|
|
return _ret
|
2024-08-25 04:08:24 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
func QPdfWriter_TrUtf82(s string, c string) string {
|
|
|
|
s_Cstring := C.CString(s)
|
|
|
|
defer C.free(unsafe.Pointer(s_Cstring))
|
|
|
|
c_Cstring := C.CString(c)
|
|
|
|
defer C.free(unsafe.Pointer(c_Cstring))
|
2024-09-14 22:29:05 +00:00
|
|
|
var _ms *C.struct_miqt_string = C.QPdfWriter_TrUtf82(s_Cstring, c_Cstring)
|
|
|
|
_ret := C.GoStringN(&_ms.data, C.int(int64(_ms.len)))
|
|
|
|
C.free(unsafe.Pointer(_ms))
|
|
|
|
return _ret
|
2024-08-25 04:08:24 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
func QPdfWriter_TrUtf83(s string, c string, n int) string {
|
|
|
|
s_Cstring := C.CString(s)
|
|
|
|
defer C.free(unsafe.Pointer(s_Cstring))
|
|
|
|
c_Cstring := C.CString(c)
|
|
|
|
defer C.free(unsafe.Pointer(c_Cstring))
|
2024-09-14 22:29:05 +00:00
|
|
|
var _ms *C.struct_miqt_string = C.QPdfWriter_TrUtf83(s_Cstring, c_Cstring, (C.int)(n))
|
|
|
|
_ret := C.GoStringN(&_ms.data, C.int(int64(_ms.len)))
|
|
|
|
C.free(unsafe.Pointer(_ms))
|
|
|
|
return _ret
|
2024-08-25 04:08:24 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
func (this *QPdfWriter) AddFileAttachment3(fileName string, data *QByteArray, mimeType string) {
|
2024-10-16 05:07:56 +00:00
|
|
|
fileName_ms := libmiqt.Strdupg(fileName)
|
2024-09-14 22:29:05 +00:00
|
|
|
defer C.free(fileName_ms)
|
2024-10-16 05:07:56 +00:00
|
|
|
mimeType_ms := libmiqt.Strdupg(mimeType)
|
2024-09-14 22:29:05 +00:00
|
|
|
defer C.free(mimeType_ms)
|
|
|
|
C.QPdfWriter_AddFileAttachment3(this.h, (*C.struct_miqt_string)(fileName_ms), data.cPointer(), (*C.struct_miqt_string)(mimeType_ms))
|
2024-08-25 04:08:24 +00:00
|
|
|
}
|
|
|
|
|
2024-09-14 22:29:05 +00:00
|
|
|
// Delete this object from C++ memory.
|
2024-08-25 04:08:24 +00:00
|
|
|
func (this *QPdfWriter) Delete() {
|
|
|
|
C.QPdfWriter_Delete(this.h)
|
|
|
|
}
|
2024-09-14 22:29:05 +00:00
|
|
|
|
|
|
|
// GoGC adds a Go Finalizer to this pointer, so that it will be deleted
|
|
|
|
// from C++ memory once it is unreachable from Go memory.
|
|
|
|
func (this *QPdfWriter) GoGC() {
|
|
|
|
runtime.SetFinalizer(this, func(this *QPdfWriter) {
|
|
|
|
this.Delete()
|
|
|
|
runtime.KeepAlive(this.h)
|
|
|
|
})
|
|
|
|
}
|