web
You’re offline. This is a read only version of the page.
close
Skip to main content

Announcements

No record found.

News and Announcements icon
Community site session details

Community site session details

Session Id :
Finance | Project Operations, Human Resources, ...
Answered

Create one binary from x files

(0) ShareShare
ReportReport
Posted on by 174

Hi,

I would like to create one binary value for multiple PDF's.

Like below sample I get a docuref and send it binary into SQL.

How can I expand it so I get one binary with multiple PDF's inside?

pslip = conIns(pslip,packingSlipCounter   1,inventTrans.PackingSlipId);
            datephys = conIns(datephys,packingSlipCounter   1,inventTrans.DatePhysical);
            refid = conIns(refid,packingSlipCounter   1,inventTransOrigin.ReferenceId);

for(int i = 1; i <=conLen(pslip); i  )
            {
                custPackingSlipJour = CustPackingSlipJour::findFromCustPackingSlipTrans(conPeek(refid, i), conPeek(pslip, i), conPeek(datephys, i));
                select docuRef
                where docuRef.RefCompanyId == custPackingSlipJour.DataAreaId &&
                      docuRef.RefTableId == custPackingSlipJour.TableId &&
                      docuRef.RefRecId == custPackingSlipJour.RecId &&
                      docuRef.TypeId == begaParameters.DocuTypeId;

if (docuRef)
                {
                    System.IO.Stream stream = DocumentManagement::getAttachmentStream(docuRef);
                    cmrFile = filePath   docuRef.originalFileName();
                    System.IO.FileStream fileStream = new System.IO.FileStream(cmrFile, System.IO.FileMode::Create, System.IO.FileAccess::ReadWrite);
                    stream.CopyTo(fileStream);
                    fileStream.Close();
                }
                
                ////
                ////
        

  strfmt(",(sele///ct * FROM Openro/wset( Bulk '%1', Single_Blob) as CmrImage)",cmrFile)

I have the same question (0)
  • Suggested answer
    Sergei Minozhenko Profile Picture
    23,095 on at

    Hi RadekM,

    You can't just combine binaries to get one file. You need to use an external tool like PdfSharp to combine several pdf files to one.

    www.pdfsharp.net/.../ConcatenateDocuments-sample.ashx

  • RadekM Profile Picture
    174 on at

    Okay so it's not possible to make this in X++ code.

    I wasn't sure if I can hide under one binary 2 or more files.

  • Suggested answer
    Sergei Minozhenko Profile Picture
    23,095 on at

    Hi RadekM,

    PdfSharp is .net library and it's included in F&O (probably from 10.0.12 or 10.0.13). You can use it in x++ as well.

    There is an old post about merging, you can try to copy-paste x++ code to check if it's working in F&O dynamicsaxgyan.wordpress.com/.../

  • RadekM Profile Picture
    174 on at

    Cant find a library like this in AOT. Its propable different here and the code don't work it shows errors at first lines already.

  • Sergei Minozhenko Profile Picture
    23,095 on at

    Hi RadekM,

    Which F&O version are you using?

  • Sergei Minozhenko Profile Picture
    23,095 on at

    Hi RadekM,

    Just mentioned that PDFSharp was brought to my environment by another ISV solution. So if you don't have it in your environment you can download the package from www.nuget.org/.../ , extract dll from it and add it as a reference in your project.

  • RadekM Profile Picture
    174 on at

    Im using 10.0.12 u36

  • Verified answer
    Sergei Minozhenko Profile Picture
    23,095 on at

    Hi RadekM,

    In this case, you need to add a reference to pdfSharp dll (check the previous comment).

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Introducing the 2026 Season 1 community Super Users

Congratulations to our 2026 Super Stars!

Meet the Microsoft Dynamics 365 Contact Center Champions

We are thrilled to have these Champions in our Community!

Congratulations to the March Top 10 Community Leaders

These are the community rock stars!

Leaderboard > Finance | Project Operations, Human Resources, AX, GP, SL

#1
Giorgio Bonacorsi Profile Picture

Giorgio Bonacorsi 681

#2
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 448 Super User 2026 Season 1

#3
Syed Haris Shah Profile Picture

Syed Haris Shah 218 Super User 2026 Season 1

Last 30 days Overall leaderboard

Product updates

Dynamics 365 release plans