diff --git a/.github/workflows/go.yml b/.github/workflows/go.yml index 3d5e8ebe..80d1cdeb 100644 --- a/.github/workflows/go.yml +++ b/.github/workflows/go.yml @@ -17,9 +17,9 @@ jobs: matrix: os: [ ubuntu-latest, macos-latest, windows-latest ] go: [ "1.20", "1.21", "1.22" ] - pdfium: [ "4849", "6281" ] + pdfium: [ "4849", "6392" ] env: - PDFIUM_EXPERIMENTAL_VERSION: "6281" + PDFIUM_EXPERIMENTAL_VERSION: "6392" PDFIUM_EXPERIMENTAL_GO_VERSION: "1.22" runs-on: ${{ matrix.os }} steps: diff --git a/.github/workflows/pdfium-windows.pc b/.github/workflows/pdfium-windows.pc index b4a6e549..dde0542f 100644 --- a/.github/workflows/pdfium-windows.pc +++ b/.github/workflows/pdfium-windows.pc @@ -4,7 +4,7 @@ includedir=D:/opt/pdfium/include Name: PDFium Description: PDFium -Version: 6281 +Version: 6392 Requires: Libs: -L${libdir} -lpdfium diff --git a/.github/workflows/pdfium.pc b/.github/workflows/pdfium.pc index 0fc0ec1b..47f02db9 100644 --- a/.github/workflows/pdfium.pc +++ b/.github/workflows/pdfium.pc @@ -4,7 +4,7 @@ includedir=/opt/pdfium/include Name: PDFium Description: PDFium -Version: 6281 +Version: 6392 Requires: Libs: -L${libdir} -lpdfium diff --git a/README.md b/README.md index 1d2ba2ef..457b49b0 100644 --- a/README.md +++ b/README.md @@ -138,7 +138,7 @@ includedir={path}/include Name: PDFium Description: PDFium -Version: 6281 +Version: 6392 Requires: Libs: -L${libdir} -lpdfium diff --git a/internal/commons/generated.go b/internal/commons/generated.go index bdc881f0..86bc867f 100644 --- a/internal/commons/generated.go +++ b/internal/commons/generated.go @@ -47,6 +47,7 @@ type Pdfium interface { FPDFAction_GetFilePath(*requests.FPDFAction_GetFilePath) (*responses.FPDFAction_GetFilePath, error) FPDFAction_GetType(*requests.FPDFAction_GetType) (*responses.FPDFAction_GetType, error) FPDFAction_GetURIPath(*requests.FPDFAction_GetURIPath) (*responses.FPDFAction_GetURIPath, error) + FPDFAnnot_AddFileAttachment(*requests.FPDFAnnot_AddFileAttachment) (*responses.FPDFAnnot_AddFileAttachment, error) FPDFAnnot_AddInkStroke(*requests.FPDFAnnot_AddInkStroke) (*responses.FPDFAnnot_AddInkStroke, error) FPDFAnnot_AppendAttachmentPoints(*requests.FPDFAnnot_AppendAttachmentPoints) (*responses.FPDFAnnot_AppendAttachmentPoints, error) FPDFAnnot_AppendObject(*requests.FPDFAnnot_AppendObject) (*responses.FPDFAnnot_AppendObject, error) @@ -55,6 +56,7 @@ type Pdfium interface { FPDFAnnot_GetAttachmentPoints(*requests.FPDFAnnot_GetAttachmentPoints) (*responses.FPDFAnnot_GetAttachmentPoints, error) FPDFAnnot_GetBorder(*requests.FPDFAnnot_GetBorder) (*responses.FPDFAnnot_GetBorder, error) FPDFAnnot_GetColor(*requests.FPDFAnnot_GetColor) (*responses.FPDFAnnot_GetColor, error) + FPDFAnnot_GetFileAttachment(*requests.FPDFAnnot_GetFileAttachment) (*responses.FPDFAnnot_GetFileAttachment, error) FPDFAnnot_GetFlags(*requests.FPDFAnnot_GetFlags) (*responses.FPDFAnnot_GetFlags, error) FPDFAnnot_GetFocusableSubtypes(*requests.FPDFAnnot_GetFocusableSubtypes) (*responses.FPDFAnnot_GetFocusableSubtypes, error) FPDFAnnot_GetFocusableSubtypesCount(*requests.FPDFAnnot_GetFocusableSubtypesCount) (*responses.FPDFAnnot_GetFocusableSubtypesCount, error) @@ -806,6 +808,16 @@ func (g *PdfiumRPC) FPDFAction_GetURIPath(request *requests.FPDFAction_GetURIPat return resp, nil } +func (g *PdfiumRPC) FPDFAnnot_AddFileAttachment(request *requests.FPDFAnnot_AddFileAttachment) (*responses.FPDFAnnot_AddFileAttachment, error) { + resp := &responses.FPDFAnnot_AddFileAttachment{} + err := g.client.Call("Plugin.FPDFAnnot_AddFileAttachment", request, resp) + if err != nil { + return nil, err + } + + return resp, nil +} + func (g *PdfiumRPC) FPDFAnnot_AddInkStroke(request *requests.FPDFAnnot_AddInkStroke) (*responses.FPDFAnnot_AddInkStroke, error) { resp := &responses.FPDFAnnot_AddInkStroke{} err := g.client.Call("Plugin.FPDFAnnot_AddInkStroke", request, resp) @@ -886,6 +898,16 @@ func (g *PdfiumRPC) FPDFAnnot_GetColor(request *requests.FPDFAnnot_GetColor) (*r return resp, nil } +func (g *PdfiumRPC) FPDFAnnot_GetFileAttachment(request *requests.FPDFAnnot_GetFileAttachment) (*responses.FPDFAnnot_GetFileAttachment, error) { + resp := &responses.FPDFAnnot_GetFileAttachment{} + err := g.client.Call("Plugin.FPDFAnnot_GetFileAttachment", request, resp) + if err != nil { + return nil, err + } + + return resp, nil +} + func (g *PdfiumRPC) FPDFAnnot_GetFlags(request *requests.FPDFAnnot_GetFlags) (*responses.FPDFAnnot_GetFlags, error) { resp := &responses.FPDFAnnot_GetFlags{} err := g.client.Call("Plugin.FPDFAnnot_GetFlags", request, resp) @@ -5496,6 +5518,24 @@ func (s *PdfiumRPCServer) FPDFAction_GetURIPath(request *requests.FPDFAction_Get return nil } +func (s *PdfiumRPCServer) FPDFAnnot_AddFileAttachment(request *requests.FPDFAnnot_AddFileAttachment, resp *responses.FPDFAnnot_AddFileAttachment) (err error) { + defer func() { + if panicError := recover(); panicError != nil { + err = fmt.Errorf("panic occurred in %s: %v", "FPDFAnnot_AddFileAttachment", panicError) + } + }() + + implResp, err := s.Impl.FPDFAnnot_AddFileAttachment(request) + if err != nil { + return err + } + + // Overwrite the target address of resp to the target address of implResp. + *resp = *implResp + + return nil +} + func (s *PdfiumRPCServer) FPDFAnnot_AddInkStroke(request *requests.FPDFAnnot_AddInkStroke, resp *responses.FPDFAnnot_AddInkStroke) (err error) { defer func() { if panicError := recover(); panicError != nil { @@ -5640,6 +5680,24 @@ func (s *PdfiumRPCServer) FPDFAnnot_GetColor(request *requests.FPDFAnnot_GetColo return nil } +func (s *PdfiumRPCServer) FPDFAnnot_GetFileAttachment(request *requests.FPDFAnnot_GetFileAttachment, resp *responses.FPDFAnnot_GetFileAttachment) (err error) { + defer func() { + if panicError := recover(); panicError != nil { + err = fmt.Errorf("panic occurred in %s: %v", "FPDFAnnot_GetFileAttachment", panicError) + } + }() + + implResp, err := s.Impl.FPDFAnnot_GetFileAttachment(request) + if err != nil { + return err + } + + // Overwrite the target address of resp to the target address of implResp. + *resp = *implResp + + return nil +} + func (s *PdfiumRPCServer) FPDFAnnot_GetFlags(request *requests.FPDFAnnot_GetFlags, resp *responses.FPDFAnnot_GetFlags) (err error) { defer func() { if panicError := recover(); panicError != nil { diff --git a/internal/implementation_cgo/fpdf_annot.go b/internal/implementation_cgo/fpdf_annot.go index e38f63e0..1a3a7859 100644 --- a/internal/implementation_cgo/fpdf_annot.go +++ b/internal/implementation_cgo/fpdf_annot.go @@ -1626,3 +1626,64 @@ func (p *PdfiumImplementation) FPDFAnnot_SetURI(request *requests.FPDFAnnot_SetU return &responses.FPDFAnnot_SetURI{}, nil } + +// FPDFAnnot_GetFileAttachment get the attachment from the given annotation. +// Experimental API. +func (p *PdfiumImplementation) FPDFAnnot_GetFileAttachment(request *requests.FPDFAnnot_GetFileAttachment) (*responses.FPDFAnnot_GetFileAttachment, error) { + p.Lock() + defer p.Unlock() + + documentHandle, err := p.getDocumentHandle(request.Document) + if err != nil { + return nil, err + } + + annotationHandle, err := p.getAnnotationHandle(request.Annotation) + if err != nil { + return nil, err + } + + handle := C.FPDFAnnot_GetFileAttachment(annotationHandle.handle) + if handle == nil { + return nil, errors.New("could not get attachment object") + } + + attachmentHandle := p.registerAttachment(handle, documentHandle) + + return &responses.FPDFAnnot_GetFileAttachment{ + Attachment: attachmentHandle.nativeRef, + }, nil +} + +// FPDFAnnot_AddFileAttachment Add an embedded file to the given annotation. +// Experimental API. +func (p *PdfiumImplementation) FPDFAnnot_AddFileAttachment(request *requests.FPDFAnnot_AddFileAttachment) (*responses.FPDFAnnot_AddFileAttachment, error) { + p.Lock() + defer p.Unlock() + + documentHandle, err := p.getDocumentHandle(request.Document) + if err != nil { + return nil, err + } + + annotationHandle, err := p.getAnnotationHandle(request.Annotation) + if err != nil { + return nil, err + } + + transformedName, err := p.transformUTF8ToUTF16LE(request.Name) + if err != nil { + return nil, err + } + + handle := C.FPDFAnnot_AddFileAttachment(annotationHandle.handle, (C.FPDF_WIDESTRING)(unsafe.Pointer(&transformedName[0]))) + if handle == nil { + return nil, errors.New("could not get attachment object") + } + + attachmentHandle := p.registerAttachment(handle, documentHandle) + + return &responses.FPDFAnnot_AddFileAttachment{ + Attachment: attachmentHandle.nativeRef, + }, nil +} diff --git a/internal/implementation_cgo/fpdf_annot_no_experimental.go b/internal/implementation_cgo/fpdf_annot_no_experimental.go index 6bce77c7..6350b494 100644 --- a/internal/implementation_cgo/fpdf_annot_no_experimental.go +++ b/internal/implementation_cgo/fpdf_annot_no_experimental.go @@ -440,3 +440,15 @@ func (p *PdfiumImplementation) FPDFAnnot_GetFormFieldExportValue(request *reques func (p *PdfiumImplementation) FPDFAnnot_SetURI(request *requests.FPDFAnnot_SetURI) (*responses.FPDFAnnot_SetURI, error) { return nil, pdfium_errors.ErrExperimentalUnsupported } + +// FPDFAnnot_GetFileAttachment get the attachment from the given annotation. +// Experimental API. +func (p *PdfiumImplementation) FPDFAnnot_GetFileAttachment(request *requests.FPDFAnnot_GetFileAttachment) (*responses.FPDFAnnot_GetFileAttachment, error) { + return nil, pdfium_errors.ErrExperimentalUnsupported +} + +// FPDFAnnot_AddFileAttachment Add an embedded file to the given annotation. +// Experimental API. +func (p *PdfiumImplementation) FPDFAnnot_AddFileAttachment(request *requests.FPDFAnnot_AddFileAttachment) (*responses.FPDFAnnot_AddFileAttachment, error) { + return nil, pdfium_errors.ErrExperimentalUnsupported +} diff --git a/internal/implementation_webassembly/fpdf_annot.go b/internal/implementation_webassembly/fpdf_annot.go index 74349c83..a45b9f21 100644 --- a/internal/implementation_webassembly/fpdf_annot.go +++ b/internal/implementation_webassembly/fpdf_annot.go @@ -1,5 +1,6 @@ package implementation_webassembly +import "C" import ( "errors" "unsafe" @@ -2193,3 +2194,75 @@ func (p *PdfiumImplementation) FPDFAnnot_SetURI(request *requests.FPDFAnnot_SetU return &responses.FPDFAnnot_SetURI{}, nil } + +// FPDFAnnot_GetFileAttachment get the attachment from the given annotation. +// Experimental API. +func (p *PdfiumImplementation) FPDFAnnot_GetFileAttachment(request *requests.FPDFAnnot_GetFileAttachment) (*responses.FPDFAnnot_GetFileAttachment, error) { + p.Lock() + defer p.Unlock() + + documentHandle, err := p.getDocumentHandle(request.Document) + if err != nil { + return nil, err + } + + annotationHandle, err := p.getAnnotationHandle(request.Annotation) + if err != nil { + return nil, err + } + + res, err := p.Module.ExportedFunction("FPDFAnnot_GetFileAttachment").Call(p.Context, *annotationHandle.handle) + if err != nil { + return nil, err + } + + handle := res[0] + if handle == 0 { + return nil, errors.New("could not get attachment object") + } + + attachmentHandle := p.registerAttachment(&handle, documentHandle) + + return &responses.FPDFAnnot_GetFileAttachment{ + Attachment: attachmentHandle.nativeRef, + }, nil +} + +// FPDFAnnot_AddFileAttachment Add an embedded file to the given annotation. +// Experimental API. +func (p *PdfiumImplementation) FPDFAnnot_AddFileAttachment(request *requests.FPDFAnnot_AddFileAttachment) (*responses.FPDFAnnot_AddFileAttachment, error) { + p.Lock() + defer p.Unlock() + + documentHandle, err := p.getDocumentHandle(request.Document) + if err != nil { + return nil, err + } + + annotationHandle, err := p.getAnnotationHandle(request.Annotation) + if err != nil { + return nil, err + } + + namePointer, err := p.CFPDF_WIDESTRING(request.Name) + if err != nil { + return nil, err + } + defer namePointer.Free() + + res, err := p.Module.ExportedFunction("FPDFAnnot_AddFileAttachment").Call(p.Context, *annotationHandle.handle, namePointer.Pointer) + if err != nil { + return nil, err + } + + handle := res[0] + if handle == 0 { + return nil, errors.New("could not get attachment object") + } + + attachmentHandle := p.registerAttachment(&handle, documentHandle) + + return &responses.FPDFAnnot_AddFileAttachment{ + Attachment: attachmentHandle.nativeRef, + }, nil +} diff --git a/multi_threaded/generated.go b/multi_threaded/generated.go index c2bd4d8c..28a80c9b 100644 --- a/multi_threaded/generated.go +++ b/multi_threaded/generated.go @@ -291,6 +291,14 @@ func (i *pdfiumInstance) FPDFAction_GetURIPath(request *requests.FPDFAction_GetU return i.worker.plugin.FPDFAction_GetURIPath(request) } +func (i *pdfiumInstance) FPDFAnnot_AddFileAttachment(request *requests.FPDFAnnot_AddFileAttachment) (*responses.FPDFAnnot_AddFileAttachment, error) { + if i.closed { + return nil, errors.New("instance is closed") + } + + return i.worker.plugin.FPDFAnnot_AddFileAttachment(request) +} + func (i *pdfiumInstance) FPDFAnnot_AddInkStroke(request *requests.FPDFAnnot_AddInkStroke) (*responses.FPDFAnnot_AddInkStroke, error) { if i.closed { return nil, errors.New("instance is closed") @@ -355,6 +363,14 @@ func (i *pdfiumInstance) FPDFAnnot_GetColor(request *requests.FPDFAnnot_GetColor return i.worker.plugin.FPDFAnnot_GetColor(request) } +func (i *pdfiumInstance) FPDFAnnot_GetFileAttachment(request *requests.FPDFAnnot_GetFileAttachment) (*responses.FPDFAnnot_GetFileAttachment, error) { + if i.closed { + return nil, errors.New("instance is closed") + } + + return i.worker.plugin.FPDFAnnot_GetFileAttachment(request) +} + func (i *pdfiumInstance) FPDFAnnot_GetFlags(request *requests.FPDFAnnot_GetFlags) (*responses.FPDFAnnot_GetFlags, error) { if i.closed { return nil, errors.New("instance is closed") diff --git a/pdfium.go b/pdfium.go index 5f25088c..695e213c 100644 --- a/pdfium.go +++ b/pdfium.go @@ -1919,6 +1919,14 @@ type Pdfium interface { // Experimental API. FPDFAnnot_SetURI(request *requests.FPDFAnnot_SetURI) (*responses.FPDFAnnot_SetURI, error) + // FPDFAnnot_GetFileAttachment get the attachment from the given annotation. + // Experimental API. + FPDFAnnot_GetFileAttachment(request *requests.FPDFAnnot_GetFileAttachment) (*responses.FPDFAnnot_GetFileAttachment, error) + + // FPDFAnnot_AddFileAttachment Add an embedded file to the given annotation. + // Experimental API. + FPDFAnnot_AddFileAttachment(request *requests.FPDFAnnot_AddFileAttachment) (*responses.FPDFAnnot_AddFileAttachment, error) + // End fpdf_annot.h // Start fpdf_formfill.h diff --git a/requests/fpdf_annot.go b/requests/fpdf_annot.go index fe2dc367..a59a8a37 100644 --- a/requests/fpdf_annot.go +++ b/requests/fpdf_annot.go @@ -304,3 +304,14 @@ type FPDFAnnot_SetURI struct { Annotation references.FPDF_ANNOTATION URI string } + +type FPDFAnnot_GetFileAttachment struct { + Document references.FPDF_DOCUMENT + Annotation references.FPDF_ANNOTATION +} + +type FPDFAnnot_AddFileAttachment struct { + Document references.FPDF_DOCUMENT + Annotation references.FPDF_ANNOTATION + Name string +} diff --git a/responses/fpdf_annot.go b/responses/fpdf_annot.go index e8cc2ffb..a5c8d3b8 100644 --- a/responses/fpdf_annot.go +++ b/responses/fpdf_annot.go @@ -223,3 +223,11 @@ type FPDFAnnot_GetFormFieldExportValue struct { } type FPDFAnnot_SetURI struct{} + +type FPDFAnnot_GetFileAttachment struct { + Attachment references.FPDF_ATTACHMENT +} + +type FPDFAnnot_AddFileAttachment struct { + Attachment references.FPDF_ATTACHMENT +} diff --git a/shared_tests/fpdf_annot.go b/shared_tests/fpdf_annot.go index 6e224243..709b7b2d 100644 --- a/shared_tests/fpdf_annot.go +++ b/shared_tests/fpdf_annot.go @@ -353,7 +353,7 @@ var _ = Describe("fpdf_annot", func() { enums.FPDF_ANNOT_SUBTYPE_CARET: false, enums.FPDF_ANNOT_SUBTYPE_INK: true, enums.FPDF_ANNOT_SUBTYPE_POPUP: true, - enums.FPDF_ANNOT_SUBTYPE_FILEATTACHMENT: false, + enums.FPDF_ANNOT_SUBTYPE_FILEATTACHMENT: true, enums.FPDF_ANNOT_SUBTYPE_SOUND: false, enums.FPDF_ANNOT_SUBTYPE_MOVIE: false, enums.FPDF_ANNOT_SUBTYPE_WIDGET: false, @@ -1860,4 +1860,245 @@ var _ = Describe("fpdf_annot", func() { }) }) }) + + Context("a PDF file with a file attached to an annotation", func() { + var doc references.FPDF_DOCUMENT + + BeforeEach(func() { + pdfData, err := ioutil.ReadFile(TestDataPath + "/testdata/annotation_fileattachment.pdf") + Expect(err).To(BeNil()) + + newDoc, err := PdfiumInstance.FPDF_LoadMemDocument(&requests.FPDF_LoadMemDocument{ + Data: &pdfData, + }) + Expect(err).To(BeNil()) + + doc = newDoc.Document + }) + + AfterEach(func() { + FPDF_CloseDocument, err := PdfiumInstance.FPDF_CloseDocument(&requests.FPDF_CloseDocument{ + Document: doc, + }) + Expect(err).To(BeNil()) + Expect(FPDF_CloseDocument).To(Not(BeNil())) + }) + + It("returns an error when calling FPDFAnnot_GetFileAttachment without a document", func() { + FPDFAnnot_GetFileAttachment, err := PdfiumInstance.FPDFAnnot_GetFileAttachment(&requests.FPDFAnnot_GetFileAttachment{}) + Expect(err).To(MatchError("document not given")) + Expect(FPDFAnnot_GetFileAttachment).To(BeNil()) + }) + + It("returns an error when calling FPDFAnnot_GetFileAttachment without a valid document", func() { + FPDFAnnot_GetFileAttachment, err := PdfiumInstance.FPDFAnnot_GetFileAttachment(&requests.FPDFAnnot_GetFileAttachment{ + Document: "test123", + }) + Expect(err).To(MatchError("could not find document handle, perhaps the doc was already closed or you tried to share documents between instances")) + Expect(FPDFAnnot_GetFileAttachment).To(BeNil()) + }) + + It("returns an error when calling FPDFAnnot_GetFileAttachment without an annotation", func() { + FPDFAnnot_GetFileAttachment, err := PdfiumInstance.FPDFAnnot_GetFileAttachment(&requests.FPDFAnnot_GetFileAttachment{ + Document: doc, + }) + Expect(err).To(MatchError("annotation not given")) + Expect(FPDFAnnot_GetFileAttachment).To(BeNil()) + }) + + It("returns an error when calling FPDFAnnot_GetFileAttachment without a valid annotation", func() { + FPDFAnnot_GetFileAttachment, err := PdfiumInstance.FPDFAnnot_GetFileAttachment(&requests.FPDFAnnot_GetFileAttachment{ + Document: doc, + Annotation: "test123", + }) + Expect(err).To(MatchError("could not find annotation handle, perhaps the annotation was already closed or you tried to share annotations between instances")) + Expect(FPDFAnnot_GetFileAttachment).To(BeNil()) + }) + + It("returns an error when calling FPDFAnnot_AddFileAttachment without a document", func() { + FPDFAnnot_AddFileAttachment, err := PdfiumInstance.FPDFAnnot_AddFileAttachment(&requests.FPDFAnnot_AddFileAttachment{}) + Expect(err).To(MatchError("document not given")) + Expect(FPDFAnnot_AddFileAttachment).To(BeNil()) + }) + + It("returns an error when calling FPDFAnnot_AddFileAttachment without a valid document", func() { + FPDFAnnot_AddFileAttachment, err := PdfiumInstance.FPDFAnnot_AddFileAttachment(&requests.FPDFAnnot_AddFileAttachment{ + Document: "test123", + }) + Expect(err).To(MatchError("could not find document handle, perhaps the doc was already closed or you tried to share documents between instances")) + Expect(FPDFAnnot_AddFileAttachment).To(BeNil()) + }) + + It("returns an error when calling FPDFAnnot_AddFileAttachment without an annotation", func() { + FPDFAnnot_AddFileAttachment, err := PdfiumInstance.FPDFAnnot_AddFileAttachment(&requests.FPDFAnnot_AddFileAttachment{ + Document: doc, + }) + Expect(err).To(MatchError("annotation not given")) + Expect(FPDFAnnot_AddFileAttachment).To(BeNil()) + }) + + It("returns an error when calling FPDFAnnot_AddFileAttachment without a valid annotation", func() { + FPDFAnnot_AddFileAttachment, err := PdfiumInstance.FPDFAnnot_AddFileAttachment(&requests.FPDFAnnot_AddFileAttachment{ + Document: doc, + Annotation: "test123", + }) + Expect(err).To(MatchError("could not find annotation handle, perhaps the annotation was already closed or you tried to share annotations between instances")) + Expect(FPDFAnnot_AddFileAttachment).To(BeNil()) + }) + + When("an annotation has been loaded", func() { + var annotation references.FPDF_ANNOTATION + BeforeEach(func() { + FPDFPage_GetAnnot, err := PdfiumInstance.FPDFPage_GetAnnot(&requests.FPDFPage_GetAnnot{ + Page: requests.Page{ + ByIndex: &requests.PageByIndex{ + Document: doc, + Index: 0, + }, + }, + Index: 0, + }) + Expect(err).To(BeNil()) + Expect(FPDFPage_GetAnnot).To(Not(BeNil())) + Expect(FPDFPage_GetAnnot.Annotation).To(Not(BeNil())) + annotation = FPDFPage_GetAnnot.Annotation + }) + + It("returns the correct annotation count", func() { + FPDFPage_GetAnnotCount, err := PdfiumInstance.FPDFPage_GetAnnotCount(&requests.FPDFPage_GetAnnotCount{ + Page: requests.Page{ + ByIndex: &requests.PageByIndex{ + Document: doc, + Index: 0, + }, + }, + }) + Expect(err).To(BeNil()) + Expect(FPDFPage_GetAnnotCount).To(Equal(&responses.FPDFPage_GetAnnotCount{ + Count: 1, + })) + }) + + It("returns the correct annotation subtype", func() { + FPDFAnnot_GetSubtype, err := PdfiumInstance.FPDFAnnot_GetSubtype(&requests.FPDFAnnot_GetSubtype{ + Annotation: annotation, + }) + Expect(err).To(BeNil()) + Expect(FPDFAnnot_GetSubtype).To(Equal(&responses.FPDFAnnot_GetSubtype{ + Subtype: enums.FPDF_ANNOT_SUBTYPE_FILEATTACHMENT, + })) + }) + + When("an attachment has been loaded", func() { + var attachment references.FPDF_ATTACHMENT + BeforeEach(func() { + FPDFAnnot_GetFileAttachment, err := PdfiumInstance.FPDFAnnot_GetFileAttachment(&requests.FPDFAnnot_GetFileAttachment{ + Document: doc, + Annotation: annotation, + }) + Expect(err).To(BeNil()) + Expect(FPDFAnnot_GetFileAttachment).To(Not(BeNil())) + Expect(FPDFAnnot_GetFileAttachment.Attachment).To(Not(BeNil())) + attachment = FPDFAnnot_GetFileAttachment.Attachment + }) + + It("returns the correct filename", func() { + FPDFAttachment_GetName, err := PdfiumInstance.FPDFAttachment_GetName(&requests.FPDFAttachment_GetName{ + Attachment: attachment, + }) + Expect(err).To(BeNil()) + Expect(FPDFAttachment_GetName).To(Equal(&responses.FPDFAttachment_GetName{ + Name: "test.txt", + })) + }) + + It("returns the correct file data", func() { + FPDFAttachment_GetFile, err := PdfiumInstance.FPDFAttachment_GetFile(&requests.FPDFAttachment_GetFile{ + Attachment: attachment, + }) + Expect(err).To(BeNil()) + Expect(FPDFAttachment_GetFile).To(Equal(&responses.FPDFAttachment_GetFile{ + Contents: []byte("test text"), + })) + }) + }) + }) + + When("an annotation has been added", func() { + var annotation references.FPDF_ANNOTATION + BeforeEach(func() { + FPDFPage_CreateAnnot, err := PdfiumInstance.FPDFPage_CreateAnnot(&requests.FPDFPage_CreateAnnot{ + Page: requests.Page{ + ByIndex: &requests.PageByIndex{ + Document: doc, + Index: 0, + }, + }, + Subtype: enums.FPDF_ANNOT_SUBTYPE_FILEATTACHMENT, + }) + Expect(err).To(BeNil()) + Expect(FPDFPage_CreateAnnot).To(Not(BeNil())) + Expect(FPDFPage_CreateAnnot.Annotation).To(Not(BeNil())) + annotation = FPDFPage_CreateAnnot.Annotation + + FPDFAnnot_AddFileAttachment, err := PdfiumInstance.FPDFAnnot_AddFileAttachment(&requests.FPDFAnnot_AddFileAttachment{ + Document: doc, + Annotation: annotation, + Name: "0.txt", + }) + Expect(err).To(BeNil()) + Expect(FPDFAnnot_AddFileAttachment).To(Not(BeNil())) + Expect(FPDFAnnot_AddFileAttachment.Attachment).To(Not(BeNil())) + }) + + It("returns the correct annotation count", func() { + FPDFPage_GetAnnotCount, err := PdfiumInstance.FPDFPage_GetAnnotCount(&requests.FPDFPage_GetAnnotCount{ + Page: requests.Page{ + ByIndex: &requests.PageByIndex{ + Document: doc, + Index: 0, + }, + }, + }) + Expect(err).To(BeNil()) + Expect(FPDFPage_GetAnnotCount).To(Equal(&responses.FPDFPage_GetAnnotCount{ + Count: 2, + })) + }) + + It("returns the correct annotation subtype", func() { + FPDFAnnot_GetSubtype, err := PdfiumInstance.FPDFAnnot_GetSubtype(&requests.FPDFAnnot_GetSubtype{ + Annotation: annotation, + }) + Expect(err).To(BeNil()) + Expect(FPDFAnnot_GetSubtype).To(Equal(&responses.FPDFAnnot_GetSubtype{ + Subtype: enums.FPDF_ANNOT_SUBTYPE_FILEATTACHMENT, + })) + }) + + When("an attachment has been loaded", func() { + var attachment references.FPDF_ATTACHMENT + BeforeEach(func() { + FPDFAnnot_GetFileAttachment, err := PdfiumInstance.FPDFAnnot_GetFileAttachment(&requests.FPDFAnnot_GetFileAttachment{ + Document: doc, + Annotation: annotation, + }) + Expect(err).To(BeNil()) + Expect(FPDFAnnot_GetFileAttachment).To(Not(BeNil())) + Expect(FPDFAnnot_GetFileAttachment.Attachment).To(Not(BeNil())) + attachment = FPDFAnnot_GetFileAttachment.Attachment + }) + + It("returns the correct filename", func() { + FPDFAttachment_GetName, err := PdfiumInstance.FPDFAttachment_GetName(&requests.FPDFAttachment_GetName{ + Attachment: attachment, + }) + Expect(err).To(BeNil()) + Expect(FPDFAttachment_GetName).To(Equal(&responses.FPDFAttachment_GetName{ + Name: "0.txt", + })) + }) + }) + }) + }) }) diff --git a/shared_tests/testdata/annotation_fileattachment.pdf b/shared_tests/testdata/annotation_fileattachment.pdf new file mode 100644 index 00000000..6d1f9548 Binary files /dev/null and b/shared_tests/testdata/annotation_fileattachment.pdf differ diff --git a/shared_tests/testdata/render_webassembly_file_testpdf_1_page_dpi.hash b/shared_tests/testdata/render_webassembly_file_testpdf_1_page_dpi.hash index 65bcec1e..9fed6e4e 100755 --- a/shared_tests/testdata/render_webassembly_file_testpdf_1_page_dpi.hash +++ b/shared_tests/testdata/render_webassembly_file_testpdf_1_page_dpi.hash @@ -1 +1 @@ -89ef4d7140adb9e40f9d4f261187acf21c7f459af938afff56c195248995d5af \ No newline at end of file +77bf4ee120cd8e8ff3791f9d78f6c233193e819c400e44565510ec4b521ef505 \ No newline at end of file diff --git a/shared_tests/testdata/render_webassembly_file_testpdf_1_page_pixels.hash b/shared_tests/testdata/render_webassembly_file_testpdf_1_page_pixels.hash index a50cf68b..9527025f 100755 --- a/shared_tests/testdata/render_webassembly_file_testpdf_1_page_pixels.hash +++ b/shared_tests/testdata/render_webassembly_file_testpdf_1_page_pixels.hash @@ -1 +1 @@ -f2829438a19b038858c4fe4fc5eb7aa3ab20f030f7806122d1fbdd5f27b48bdd \ No newline at end of file +0dc0285cce17dcd68adf2088070fd9a5dc6aa4b8cbd54e1c2b1b751bc562b67e \ No newline at end of file diff --git a/shared_tests/testdata/render_webassembly_file_testpdf_bytes.hash b/shared_tests/testdata/render_webassembly_file_testpdf_bytes.hash index a50cf68b..9527025f 100755 --- a/shared_tests/testdata/render_webassembly_file_testpdf_bytes.hash +++ b/shared_tests/testdata/render_webassembly_file_testpdf_bytes.hash @@ -1 +1 @@ -f2829438a19b038858c4fe4fc5eb7aa3ab20f030f7806122d1fbdd5f27b48bdd \ No newline at end of file +0dc0285cce17dcd68adf2088070fd9a5dc6aa4b8cbd54e1c2b1b751bc562b67e \ No newline at end of file diff --git a/shared_tests/testdata/render_webassembly_file_testpdf_filepath.hash b/shared_tests/testdata/render_webassembly_file_testpdf_filepath.hash index a50cf68b..9527025f 100755 --- a/shared_tests/testdata/render_webassembly_file_testpdf_filepath.hash +++ b/shared_tests/testdata/render_webassembly_file_testpdf_filepath.hash @@ -1 +1 @@ -f2829438a19b038858c4fe4fc5eb7aa3ab20f030f7806122d1fbdd5f27b48bdd \ No newline at end of file +0dc0285cce17dcd68adf2088070fd9a5dc6aa4b8cbd54e1c2b1b751bc562b67e \ No newline at end of file diff --git a/shared_tests/testdata/render_webassembly_file_testpdf_jpg.hash b/shared_tests/testdata/render_webassembly_file_testpdf_jpg.hash index a50cf68b..9527025f 100755 --- a/shared_tests/testdata/render_webassembly_file_testpdf_jpg.hash +++ b/shared_tests/testdata/render_webassembly_file_testpdf_jpg.hash @@ -1 +1 @@ -f2829438a19b038858c4fe4fc5eb7aa3ab20f030f7806122d1fbdd5f27b48bdd \ No newline at end of file +0dc0285cce17dcd68adf2088070fd9a5dc6aa4b8cbd54e1c2b1b751bc562b67e \ No newline at end of file diff --git a/shared_tests/testdata/render_webassembly_file_testpdf_max_filesize.hash b/shared_tests/testdata/render_webassembly_file_testpdf_max_filesize.hash index 7cbe3ab5..4648a4b4 100755 --- a/shared_tests/testdata/render_webassembly_file_testpdf_max_filesize.hash +++ b/shared_tests/testdata/render_webassembly_file_testpdf_max_filesize.hash @@ -1 +1 @@ -8f077fb48dbb87c85107ab6b414811a9adb74a956fb2939479b95b5553ba45f7 \ No newline at end of file +d2ee80387d50620f4f9ccec5dded1375565462acfc6aac5353acd774fd95c396 \ No newline at end of file diff --git a/shared_tests/testdata/render_webassembly_file_testpdf_multiple_pages_dpi.hash b/shared_tests/testdata/render_webassembly_file_testpdf_multiple_pages_dpi.hash index 52a787a6..1c8f0a50 100755 --- a/shared_tests/testdata/render_webassembly_file_testpdf_multiple_pages_dpi.hash +++ b/shared_tests/testdata/render_webassembly_file_testpdf_multiple_pages_dpi.hash @@ -1 +1 @@ -984a8996b59cffbcf58dd4723c7bc2f8bab9a155f376770ca776bb515a4d9288 \ No newline at end of file +8fc1fd5936a73681bb8d3015aa4073029873610a4be289a9b5a206760fd12683 \ No newline at end of file diff --git a/shared_tests/testdata/render_webassembly_file_testpdf_multiple_pages_pixels.hash b/shared_tests/testdata/render_webassembly_file_testpdf_multiple_pages_pixels.hash index 62ebde1c..74d05861 100755 --- a/shared_tests/testdata/render_webassembly_file_testpdf_multiple_pages_pixels.hash +++ b/shared_tests/testdata/render_webassembly_file_testpdf_multiple_pages_pixels.hash @@ -1 +1 @@ -7f145a4d654e16ffab3322497342ec785c0efebbf5ffb2b4f94d5a3bca766939 \ No newline at end of file +89faa83ff977d0ba7a5ba3babb5216b33166cbb06e3ae53400084e9daaa5d5f5 \ No newline at end of file diff --git a/shared_tests/testdata/render_webassembly_file_testpdf_no_filepath.hash b/shared_tests/testdata/render_webassembly_file_testpdf_no_filepath.hash index a50cf68b..9527025f 100755 --- a/shared_tests/testdata/render_webassembly_file_testpdf_no_filepath.hash +++ b/shared_tests/testdata/render_webassembly_file_testpdf_no_filepath.hash @@ -1 +1 @@ -f2829438a19b038858c4fe4fc5eb7aa3ab20f030f7806122d1fbdd5f27b48bdd \ No newline at end of file +0dc0285cce17dcd68adf2088070fd9a5dc6aa4b8cbd54e1c2b1b751bc562b67e \ No newline at end of file diff --git a/shared_tests/testdata/render_webassembly_file_testpdf_png.hash b/shared_tests/testdata/render_webassembly_file_testpdf_png.hash index 286426aa..1c75854f 100755 --- a/shared_tests/testdata/render_webassembly_file_testpdf_png.hash +++ b/shared_tests/testdata/render_webassembly_file_testpdf_png.hash @@ -1 +1 @@ -e12beb9ae2215d8816f3581564e788b66b99559bf2677b4b264b65ad565046e8 \ No newline at end of file +8662379d6bebea871f505e0c6d500f19b92d7470d6941058ce1fb00a9277808e \ No newline at end of file diff --git a/shared_tests/testdata/render_webassembly_page_alpha_channel.hash b/shared_tests/testdata/render_webassembly_page_alpha_channel.hash index e1a49b3f..c80f5675 100755 --- a/shared_tests/testdata/render_webassembly_page_alpha_channel.hash +++ b/shared_tests/testdata/render_webassembly_page_alpha_channel.hash @@ -1 +1 @@ -3abd50c3c34f37fdc3941c22ff118e82974df8621551e2b821649b05120b5c83 \ No newline at end of file +5162bbc4c340ed3204fc348a4a8fe4454812419dbde77f506dd87d7a3f39b721 \ No newline at end of file diff --git a/shared_tests/testdata/render_webassembly_pages_testpdf_dpi_200_300.hash b/shared_tests/testdata/render_webassembly_pages_testpdf_dpi_200_300.hash index 93f53479..9f087b22 100755 --- a/shared_tests/testdata/render_webassembly_pages_testpdf_dpi_200_300.hash +++ b/shared_tests/testdata/render_webassembly_pages_testpdf_dpi_200_300.hash @@ -1 +1 @@ -69fc57e064d7429307488f45818a74c27cfc9fa5d964989e2a4bd13ecd391051 \ No newline at end of file +7b81a6c8e86a297675d3dfadca10119c460b7403f4e55d32d433099f046ac514 \ No newline at end of file diff --git a/shared_tests/testdata/render_webassembly_pages_testpdf_dpi_300.hash b/shared_tests/testdata/render_webassembly_pages_testpdf_dpi_300.hash index 2d077024..da85af42 100755 --- a/shared_tests/testdata/render_webassembly_pages_testpdf_dpi_300.hash +++ b/shared_tests/testdata/render_webassembly_pages_testpdf_dpi_300.hash @@ -1 +1 @@ -1e4e0a7e0ccc11ee7c0bdb0ea85d8f6017465722d9036b7e560e56b1962d7f92 \ No newline at end of file +3578b0a3e2a6c6f49283b3a406de5846ab9b04b0d6574d501e914b38d05b2f47 \ No newline at end of file diff --git a/shared_tests/testdata/render_webassembly_pages_testpdf_dpi_300_padding_50.hash b/shared_tests/testdata/render_webassembly_pages_testpdf_dpi_300_padding_50.hash index 5373e52b..08c4a779 100755 --- a/shared_tests/testdata/render_webassembly_pages_testpdf_dpi_300_padding_50.hash +++ b/shared_tests/testdata/render_webassembly_pages_testpdf_dpi_300_padding_50.hash @@ -1 +1 @@ -586494a4df25ef1525c0e15ec2d2b71980f01b17ddd41c33a7afe4a8f712cede \ No newline at end of file +7105c3bdfe23d280c5737366f922daa014cb5d5ea47169004d726eb93455c6c4 \ No newline at end of file diff --git a/shared_tests/testdata/render_webassembly_pages_testpdf_pixels_0x2000.hash b/shared_tests/testdata/render_webassembly_pages_testpdf_pixels_0x2000.hash index 0cc8f940..0146bdfa 100755 --- a/shared_tests/testdata/render_webassembly_pages_testpdf_pixels_0x2000.hash +++ b/shared_tests/testdata/render_webassembly_pages_testpdf_pixels_0x2000.hash @@ -1 +1 @@ -cf6f91d0cbb3c3be21419f1f0a5b41263c7f8ab9af2423ecb28b5d4f88e1ba66 \ No newline at end of file +9a831b772cdf00383693039923a4e3eee3c174b15da0fb9fa5162c08822f9af7 \ No newline at end of file diff --git a/shared_tests/testdata/render_webassembly_pages_testpdf_pixels_0x2000_0x1500.hash b/shared_tests/testdata/render_webassembly_pages_testpdf_pixels_0x2000_0x1500.hash index cca1bec8..d5420957 100755 --- a/shared_tests/testdata/render_webassembly_pages_testpdf_pixels_0x2000_0x1500.hash +++ b/shared_tests/testdata/render_webassembly_pages_testpdf_pixels_0x2000_0x1500.hash @@ -1 +1 @@ -bef9e01e43f6370cdd999d6a080a716feee1667472cc6ffa1f9da17f9f5a9dfe \ No newline at end of file +f975f36e3fba02a5ded493e639c39bf990adb01b582b12399fea75108c414175 \ No newline at end of file diff --git a/shared_tests/testdata/render_webassembly_pages_testpdf_pixels_2000x0.hash b/shared_tests/testdata/render_webassembly_pages_testpdf_pixels_2000x0.hash index debdd73e..ab0eef78 100755 --- a/shared_tests/testdata/render_webassembly_pages_testpdf_pixels_2000x0.hash +++ b/shared_tests/testdata/render_webassembly_pages_testpdf_pixels_2000x0.hash @@ -1 +1 @@ -647880d472f8d2536b091b7383365167e568ad8be5ef71924456cc3d8533eeba \ No newline at end of file +c01e0fc3f98757aefe1ac76ef73ede45226a1637c9779cd325a73bc6c78cc746 \ No newline at end of file diff --git a/shared_tests/testdata/render_webassembly_pages_testpdf_pixels_2000x0_1500x0.hash b/shared_tests/testdata/render_webassembly_pages_testpdf_pixels_2000x0_1500x0.hash index 5fc1ac55..b07b43d7 100755 --- a/shared_tests/testdata/render_webassembly_pages_testpdf_pixels_2000x0_1500x0.hash +++ b/shared_tests/testdata/render_webassembly_pages_testpdf_pixels_2000x0_1500x0.hash @@ -1 +1 @@ -0bb74df835f71b815a255b63112e5f4864937510851363b03f02566d61983044 \ No newline at end of file +cef280c400ec324142f27dc30a899b7f193cf1a3c01b09b865eab78891c6b3fa \ No newline at end of file diff --git a/shared_tests/testdata/render_webassembly_pages_testpdf_pixels_2000x2000.hash b/shared_tests/testdata/render_webassembly_pages_testpdf_pixels_2000x2000.hash index 0cc8f940..0146bdfa 100755 --- a/shared_tests/testdata/render_webassembly_pages_testpdf_pixels_2000x2000.hash +++ b/shared_tests/testdata/render_webassembly_pages_testpdf_pixels_2000x2000.hash @@ -1 +1 @@ -cf6f91d0cbb3c3be21419f1f0a5b41263c7f8ab9af2423ecb28b5d4f88e1ba66 \ No newline at end of file +9a831b772cdf00383693039923a4e3eee3c174b15da0fb9fa5162c08822f9af7 \ No newline at end of file diff --git a/shared_tests/testdata/render_webassembly_pages_testpdf_pixels_2000x2000_1500x1500.hash b/shared_tests/testdata/render_webassembly_pages_testpdf_pixels_2000x2000_1500x1500.hash index cca1bec8..d5420957 100755 --- a/shared_tests/testdata/render_webassembly_pages_testpdf_pixels_2000x2000_1500x1500.hash +++ b/shared_tests/testdata/render_webassembly_pages_testpdf_pixels_2000x2000_1500x1500.hash @@ -1 +1 @@ -bef9e01e43f6370cdd999d6a080a716feee1667472cc6ffa1f9da17f9f5a9dfe \ No newline at end of file +f975f36e3fba02a5ded493e639c39bf990adb01b582b12399fea75108c414175 \ No newline at end of file diff --git a/shared_tests/testdata/render_webassembly_pages_testpdf_pixels_2000x2000_2000x2000_padding_50.hash b/shared_tests/testdata/render_webassembly_pages_testpdf_pixels_2000x2000_2000x2000_padding_50.hash index 9cbd97bc..ffc877a3 100755 --- a/shared_tests/testdata/render_webassembly_pages_testpdf_pixels_2000x2000_2000x2000_padding_50.hash +++ b/shared_tests/testdata/render_webassembly_pages_testpdf_pixels_2000x2000_2000x2000_padding_50.hash @@ -1 +1 @@ -baa794a7de3133face4f732a66b3a4422725b1cb2f7e0805131044d8a3f0e39c \ No newline at end of file +85e014cfadabe2ce6f989a23173ed64ba04f0fa2a92f0f6990e560606768ffab \ No newline at end of file diff --git a/shared_tests/testdata/render_webassembly_pages_testpdf_pixels_2000x4000.hash b/shared_tests/testdata/render_webassembly_pages_testpdf_pixels_2000x4000.hash index debdd73e..ab0eef78 100755 --- a/shared_tests/testdata/render_webassembly_pages_testpdf_pixels_2000x4000.hash +++ b/shared_tests/testdata/render_webassembly_pages_testpdf_pixels_2000x4000.hash @@ -1 +1 @@ -647880d472f8d2536b091b7383365167e568ad8be5ef71924456cc3d8533eeba \ No newline at end of file +c01e0fc3f98757aefe1ac76ef73ede45226a1637c9779cd325a73bc6c78cc746 \ No newline at end of file diff --git a/shared_tests/testdata/render_webassembly_pages_testpdf_pixels_4000x2000.hash b/shared_tests/testdata/render_webassembly_pages_testpdf_pixels_4000x2000.hash index 0cc8f940..0146bdfa 100755 --- a/shared_tests/testdata/render_webassembly_pages_testpdf_pixels_4000x2000.hash +++ b/shared_tests/testdata/render_webassembly_pages_testpdf_pixels_4000x2000.hash @@ -1 +1 @@ -cf6f91d0cbb3c3be21419f1f0a5b41263c7f8ab9af2423ecb28b5d4f88e1ba66 \ No newline at end of file +9a831b772cdf00383693039923a4e3eee3c174b15da0fb9fa5162c08822f9af7 \ No newline at end of file diff --git a/shared_tests/testdata/render_webassembly_testpdf_dpi_300.hash b/shared_tests/testdata/render_webassembly_testpdf_dpi_300.hash index 94e7e88d..bbbaa152 100755 --- a/shared_tests/testdata/render_webassembly_testpdf_dpi_300.hash +++ b/shared_tests/testdata/render_webassembly_testpdf_dpi_300.hash @@ -1 +1 @@ -585f0f7cf88854a0f7a35380efb2a91917a5973153871e2f8cab4e0e671086f7 \ No newline at end of file +f6efd96c70fd2e0511d6aa7fa66d0e6c4d523cd83ea525f90167bb8623edfd98 \ No newline at end of file diff --git a/shared_tests/testdata/render_webassembly_testpdf_multiple_pdf_combined.hash b/shared_tests/testdata/render_webassembly_testpdf_multiple_pdf_combined.hash index 4c555074..06a655f0 100755 --- a/shared_tests/testdata/render_webassembly_testpdf_multiple_pdf_combined.hash +++ b/shared_tests/testdata/render_webassembly_testpdf_multiple_pdf_combined.hash @@ -1 +1 @@ -6c509ed06f3b9d9b5486d532feda6c639529aa74d349dd2c07c9a0768cf0ae25 \ No newline at end of file +3cab3588b972f07ecc0513ef9134d2ff9d278658c0bba3eca8b1b37726d4485d \ No newline at end of file diff --git a/shared_tests/testdata/render_webassembly_testpdf_pixels_0x2000.hash b/shared_tests/testdata/render_webassembly_testpdf_pixels_0x2000.hash index cc7c7520..1685ed63 100755 --- a/shared_tests/testdata/render_webassembly_testpdf_pixels_0x2000.hash +++ b/shared_tests/testdata/render_webassembly_testpdf_pixels_0x2000.hash @@ -1 +1 @@ -f598b7f16cc89c9ba8a8e6530d8f9ca3736beba990fd48d70d1f3a1fa7285c22 \ No newline at end of file +40f2b1c28a3b7b62929d8bdd0c5d97e545ff9acfacae88e38322bcf6e96df854 \ No newline at end of file diff --git a/shared_tests/testdata/render_webassembly_testpdf_pixels_2000x0.hash b/shared_tests/testdata/render_webassembly_testpdf_pixels_2000x0.hash index 115ac854..0e698672 100755 --- a/shared_tests/testdata/render_webassembly_testpdf_pixels_2000x0.hash +++ b/shared_tests/testdata/render_webassembly_testpdf_pixels_2000x0.hash @@ -1 +1 @@ -2074591602cd4b207f3783fb9978e4ec08b99abb211d31ff1696172aba126f1a \ No newline at end of file +52ee0b41c6f1654ff87855a4f10f2d4822c8fe589a73dc19579d3f6ae38393ca \ No newline at end of file diff --git a/shared_tests/testdata/render_webassembly_testpdf_pixels_2000x2000.hash b/shared_tests/testdata/render_webassembly_testpdf_pixels_2000x2000.hash index cc7c7520..1685ed63 100755 --- a/shared_tests/testdata/render_webassembly_testpdf_pixels_2000x2000.hash +++ b/shared_tests/testdata/render_webassembly_testpdf_pixels_2000x2000.hash @@ -1 +1 @@ -f598b7f16cc89c9ba8a8e6530d8f9ca3736beba990fd48d70d1f3a1fa7285c22 \ No newline at end of file +40f2b1c28a3b7b62929d8bdd0c5d97e545ff9acfacae88e38322bcf6e96df854 \ No newline at end of file diff --git a/shared_tests/testdata/render_webassembly_testpdf_pixels_2000x4000.hash b/shared_tests/testdata/render_webassembly_testpdf_pixels_2000x4000.hash index 115ac854..0e698672 100755 --- a/shared_tests/testdata/render_webassembly_testpdf_pixels_2000x4000.hash +++ b/shared_tests/testdata/render_webassembly_testpdf_pixels_2000x4000.hash @@ -1 +1 @@ -2074591602cd4b207f3783fb9978e4ec08b99abb211d31ff1696172aba126f1a \ No newline at end of file +52ee0b41c6f1654ff87855a4f10f2d4822c8fe589a73dc19579d3f6ae38393ca \ No newline at end of file diff --git a/shared_tests/testdata/render_webassembly_testpdf_pixels_4000x2000.hash b/shared_tests/testdata/render_webassembly_testpdf_pixels_4000x2000.hash index cc7c7520..1685ed63 100755 --- a/shared_tests/testdata/render_webassembly_testpdf_pixels_4000x2000.hash +++ b/shared_tests/testdata/render_webassembly_testpdf_pixels_4000x2000.hash @@ -1 +1 @@ -f598b7f16cc89c9ba8a8e6530d8f9ca3736beba990fd48d70d1f3a1fa7285c22 \ No newline at end of file +40f2b1c28a3b7b62929d8bdd0c5d97e545ff9acfacae88e38322bcf6e96df854 \ No newline at end of file diff --git a/single_threaded/generated.go b/single_threaded/generated.go index 01dcbc9b..6e67acc8 100644 --- a/single_threaded/generated.go +++ b/single_threaded/generated.go @@ -501,6 +501,20 @@ func (i *pdfiumInstance) FPDFAction_GetURIPath(request *requests.FPDFAction_GetU return i.pdfium.FPDFAction_GetURIPath(request) } +func (i *pdfiumInstance) FPDFAnnot_AddFileAttachment(request *requests.FPDFAnnot_AddFileAttachment) (resp *responses.FPDFAnnot_AddFileAttachment, err error) { + if i.closed { + return nil, errors.New("instance is closed") + } + + defer func() { + if panicError := recover(); panicError != nil { + err = fmt.Errorf("panic occurred in %s: %v", "FPDFAnnot_AddFileAttachment", panicError) + } + }() + + return i.pdfium.FPDFAnnot_AddFileAttachment(request) +} + func (i *pdfiumInstance) FPDFAnnot_AddInkStroke(request *requests.FPDFAnnot_AddInkStroke) (resp *responses.FPDFAnnot_AddInkStroke, err error) { if i.closed { return nil, errors.New("instance is closed") @@ -613,6 +627,20 @@ func (i *pdfiumInstance) FPDFAnnot_GetColor(request *requests.FPDFAnnot_GetColor return i.pdfium.FPDFAnnot_GetColor(request) } +func (i *pdfiumInstance) FPDFAnnot_GetFileAttachment(request *requests.FPDFAnnot_GetFileAttachment) (resp *responses.FPDFAnnot_GetFileAttachment, err error) { + if i.closed { + return nil, errors.New("instance is closed") + } + + defer func() { + if panicError := recover(); panicError != nil { + err = fmt.Errorf("panic occurred in %s: %v", "FPDFAnnot_GetFileAttachment", panicError) + } + }() + + return i.pdfium.FPDFAnnot_GetFileAttachment(request) +} + func (i *pdfiumInstance) FPDFAnnot_GetFlags(request *requests.FPDFAnnot_GetFlags) (resp *responses.FPDFAnnot_GetFlags, err error) { if i.closed { return nil, errors.New("instance is closed") diff --git a/webassembly/generated.go b/webassembly/generated.go index d3bd5707..0ceb5873 100644 --- a/webassembly/generated.go +++ b/webassembly/generated.go @@ -501,6 +501,20 @@ func (i *pdfiumInstance) FPDFAction_GetURIPath(request *requests.FPDFAction_GetU return i.worker.Instance.FPDFAction_GetURIPath(request) } +func (i *pdfiumInstance) FPDFAnnot_AddFileAttachment(request *requests.FPDFAnnot_AddFileAttachment) (resp *responses.FPDFAnnot_AddFileAttachment, err error) { + if i.closed { + return nil, errors.New("instance is closed") + } + + defer func() { + if panicError := recover(); panicError != nil { + err = fmt.Errorf("panic occurred in %s: %v", "FPDFAnnot_AddFileAttachment", panicError) + } + }() + + return i.worker.Instance.FPDFAnnot_AddFileAttachment(request) +} + func (i *pdfiumInstance) FPDFAnnot_AddInkStroke(request *requests.FPDFAnnot_AddInkStroke) (resp *responses.FPDFAnnot_AddInkStroke, err error) { if i.closed { return nil, errors.New("instance is closed") @@ -613,6 +627,20 @@ func (i *pdfiumInstance) FPDFAnnot_GetColor(request *requests.FPDFAnnot_GetColor return i.worker.Instance.FPDFAnnot_GetColor(request) } +func (i *pdfiumInstance) FPDFAnnot_GetFileAttachment(request *requests.FPDFAnnot_GetFileAttachment) (resp *responses.FPDFAnnot_GetFileAttachment, err error) { + if i.closed { + return nil, errors.New("instance is closed") + } + + defer func() { + if panicError := recover(); panicError != nil { + err = fmt.Errorf("panic occurred in %s: %v", "FPDFAnnot_GetFileAttachment", panicError) + } + }() + + return i.worker.Instance.FPDFAnnot_GetFileAttachment(request) +} + func (i *pdfiumInstance) FPDFAnnot_GetFlags(request *requests.FPDFAnnot_GetFlags) (resp *responses.FPDFAnnot_GetFlags, err error) { if i.closed { return nil, errors.New("instance is closed") diff --git a/webassembly/pdfium.wasm b/webassembly/pdfium.wasm index 0f35b9fc..40430eee 100755 Binary files a/webassembly/pdfium.wasm and b/webassembly/pdfium.wasm differ