Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Attaching PDFs #36

Open
sroy93 opened this issue Nov 6, 2019 · 9 comments
Open

Attaching PDFs #36

sroy93 opened this issue Nov 6, 2019 · 9 comments

Comments

@sroy93
Copy link

sroy93 commented Nov 6, 2019

Does attaching PDFs work with this plugin? I am getting a 'File not Found' error for the remote URL path to the PDF, but it is the correct path and is accessible when the URL is plugged into a browser.

Thanks!

@EddyVerbruggen
Copy link
Owner

Can you show the actual code?

@sroy93
Copy link
Author

sroy93 commented Nov 6, 2019

Sure. Here's the piece of it that contains the email portion: (See below the code for the value of the attachment path variable)

email.available().then((avail: boolean) => {
if(avail) {
dialogs.prompt({
title: "Enter Email",
message: "Please enter the address you want to send the document to below",
okButtonText: "Send",
cancelButtonText: "Cancel",
inputType: dialogs.inputType.email
}).then((r) => {
if(r.result = true) {
if(r.text != "") {
email.compose({
subject: "CPU Signed Form - " + this.cpuOrder.OrderNumber,
body: "See attachment.",
to: [r.text],
attachments: [
{
fileName: this.cpuOrder.OrderNumber + '-SIG.pdf',
path: this.pdfPath,
mimeType: 'application/pdf'
}]
}).then(
function() {
console.log("Email composer closed");
}, function(err) {
dialogs.alert({
title: "Email Not Sent"
,message: "Error: " + err
,okButtonText: "Ok"
});
});
}
else {
dialogs.alert({
title: "Enter a Valid Email"
,message: "Please enter an email address"
,okButtonText: "Ok"
});
}
}
})

                }
                else {
                    dialogs.alert({
                        title: "Email Not Supported"
                        ,message: "This device does not support OR is not set up for emailing."
                        ,okButtonText: "Ok"
                    });
                }

The error reads: "File not found for path: http://cpuimages.ivansmith.com/CPUImages/SignaturePDFs/1001903LG28-SIG.pdf"

So that is going to be the value of the variable in the code.

@EddyVerbruggen
Copy link
Owner

Quite frankly, I can't access that file either:

Screenshot 2019-11-06 at 20 59 12

@sroy93
Copy link
Author

sroy93 commented Nov 6, 2019

Well you aren't going to be able to if you aren't on the correct network. I can though from a browser.

@sroy93
Copy link
Author

sroy93 commented Nov 6, 2019

I am also displaying the PDF via another NativeScript plugin using the same variable, so the same URL. So it is not as though the app itself cannot access it.

@EddyVerbruggen
Copy link
Owner

Let’s not complicate things. Do you have the same issue with a publicly available pdf (please post an example)

@sroy93
Copy link
Author

sroy93 commented Nov 6, 2019

Good thought. I tried replacing the variable in my code with the public URL you find here. It gives the same error.

email.available().then((avail: boolean) => {
if(avail) {
dialogs.prompt({
title: "Enter Email",
message: "Please enter the address you want to send the document to below",
okButtonText: "Send",
cancelButtonText: "Cancel",
inputType: dialogs.inputType.email
}).then((r) => {
if(r.result = true) {
if(r.text != "") {
email.compose({
subject: "CPU Signed Form - " + this.cpuOrder.OrderNumber,
body: "See attachment.",
to: [r.text],
attachments: [
{
fileName: this.cpuOrder.OrderNumber + '-SIG.pdf',
path: "https://www.adobe.com/content/dam/acom/en/devnet/acrobat/pdfs/pdf_open_parameters.pdf",
mimeType: 'application/pdf'
}]
}).then(
function() {
console.log("Email composer closed");
}, function(err) {
dialogs.alert({
title: "Email Not Sent"
,message: "Error: " + err
,okButtonText: "Ok"
});
});
}
else {
dialogs.alert({
title: "Enter a Valid Email"
,message: "Please enter an email address"
,okButtonText: "Ok"
});
}
}
})

                }
                else {
                    dialogs.alert({
                        title: "Email Not Supported"
                        ,message: "This device does not support OR is not set up for emailing."
                        ,okButtonText: "Ok"
                    });
                }
            })

@sroy93
Copy link
Author

sroy93 commented Nov 22, 2019

Is there any update on this by chance? I have now tested this on an Android, as well as, iOS and the issue occurs on both.

@EddyVerbruggen
Copy link
Owner

I have not found time to look into it. Flagging it as "help wanted" so perhaps someone else can step in.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants