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

Announcements

News and Announcements icon
Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Apps / Unable to find the Err...
Power Apps
Answered

Unable to find the Error in code of pdf creating function

(0) ShareShare
ReportReport
Posted on by 2

I am trying to use the following function to create pdf of the data of my gallery from my screen:

 

Office365Outlook.SendEmailV2(user().Email,"My First expo pdf from powerapp","power app report",{Attachments:Table({Name:"SearchRepo1.pdf",ContentBytes:PDF(Gallery4)})})

 

Please check and advise the correction required.

 

MIA27_1-1679163611510.png

 

Note : I have properly followed the connector process and connected the outlook account.

 

 

Categories:
I have the same question (0)
  • Community Power Platform Member Profile Picture
    Microsoft Employee on at

    Hi @MIA27 ,

     

    I used same but not getting any error . Please reconnect outlook connector and check turn ON PDF feature from setting upcoming feature.

     

    Chitrakant27_0-1679166878795.png

     

    Thanks,

     

  • MIA27 Profile Picture
    2 on at

    sorry, tried same result.

    deleted and reconnected but still same error.

     

    can you please paste your test code

    so that i can cross check

     

     

  • Verified answer
    Community Power Platform Member Profile Picture
    Microsoft Employee on at

    Hi @MIA27 ,

     

    This is my test code -

     

    Office365Outlook.SendEmailV2(
    User().Email,
    "PDF File",
    "Galley file",
    {
    Attachments: Table(
    {
    Name: "Galleryfile.pdf",
    ContentBytes: PDF(Gallery2_3)
    }
    )
    }
    )

  • MIA27 Profile Picture
    2 on at

    Thank you it worked, 

    But very strange when written in single line its a problem. The same written by you in coding which I copied and pasted it worked. Which means I am unable to track the space, but i checked several times.

    For my learning, you people write the code directly or use another app for writing. 

     

    Regards

     

  • MIA27 Profile Picture
    2 on at

    I also wanted to confirm you about the below:

    The app is under development and my email id in outlook connector which is connected. It started working fine, it is exporting with attachment.

     

    Later the app will be given to another user's who also are in the same environment of sharepoint and outlook with different email id.

    So the pdf creation button will work for them from their mobile ?. No issue ?. 

     

    please guide. 

  • Verified answer
    Community Power Platform Member Profile Picture
    Microsoft Employee on at

    Hi @MIA27 ,

     

    Yes, It is works.

     

    Thanks,

  • MIA27 Profile Picture
    2 on at

    Got stuck in paper size of the pdf. if it is more than one page the last line etc gets cut.

    How to adjust this in A4 size, so what ever fits it will be there, rest to be in next page.

    I saw some code in Reza video, but how to bring to my code . 

    Please guide the add line in the below code to fix this issue :

     

    Office365Outlook.SendEmailV2(
    User().Email,
    "Subject to be here PowerApp of serial " & FindSerialNo.Text,
    "Email to be here of powerapp",
    {
    Attachments: Table(
    {
    Name: "ServiceDataRepo.pdf",
    ContentBytes: PDF(Gallery4)
    }
    )
    }
    )

     

    Image of the page is as below

    MIA27_0-1679247207148.png

     

    Pls note above that the first page portion cut and came in next page top , same happening with every page

     

  • Community Power Platform Member Profile Picture
    Microsoft Employee on at

    HI @MIA27 ,

     

    Use expandcontaine after gallery

    Office365Outlook.SendEmailV2(
    User().Email,
    "Subject to be here PowerApp of serial " & FindSerialNo.Text,
    "Email to be here of powerapp",
    {
    Attachments: Table(
    {
    Name: "ServiceDataRepo.pdf",
    ContentBytes: PDF(Gallery4 , {Expandcontainer:true})
    }
    )
    }
    )

     

     

    For kind your info -

    PDF also have { Orientation : Landscape,Size:Papersize.A1,Margin "24pt 24pt 24pt"}

     

    Thanks,

  • MIA27 Profile Picture
    2 on at

    Dear Chitrakant 

    Thank you for your time and advise,

     

    Expand container I already used after posting the question, earlier only screen was getting exported.

    And about orientation syntax where to be used?. after which line,  any web link where it is explained.

     

    Also, how to know the current exported pdf -  was of what size. any default of the code is there.

    I tried to find the exported page size from my acrobat reader but could not.

    This will give me an in declaration of orientation.

     

    regards

     

     

  • Community Power Platform Member Profile Picture
    Microsoft Employee on at

    Hi @MIA27 ,

     

    About orientation used after galley

    PDF(Galleydata,{ Orientation : Landscape,Size:Papersize.A1,Margin:"24pt 24pt 24pt 24pt"})

     

    Thanks,

     

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 Users!

Kudos to our 2025 Community Spotlight Honorees

Congratulations to our 2025 community superstars!

Congratulations to the March Top 10 Community Leaders!

These are the community rock stars!

Leaderboard > Power Apps

#1
11manish Profile Picture

11manish 490

#2
WarrenBelz Profile Picture

WarrenBelz 427 Most Valuable Professional

#3
Vish WR Profile Picture

Vish WR 381

Last 30 days Overall leaderboard