apenab / react-dymo

Collections of react utilities to handle the Dymo LabelWriter web service
26 stars 10 forks source link

Add function for print label #1

Closed Moosjes closed 1 year ago

Moosjes commented 3 years ago

Hello,

I like your work at react-dymo-hooks! It is very easy to read status and printers.

I do not see how I can print using one of the printers. Could you tell me how to do that?

Thank you!

apenab commented 3 years ago

Here an example.

import {dymoRequestBuilder} from "react-dymo-hooks";

const params = {
        data: `printerName=${encodeURIComponent(printerSelected)}&printParamsXml=&labelXml=${encodeURIComponent(
            xml
        )}&labelSetXml=`,
};

function handlePrintLabel() {
        dymoRequestBuilder({
            method: "POST",
            wsAction: "printLabel",
            axiosOtherParams: params,
        })
         .then(() => {})
         .catch(() => {});
}
apenab commented 3 years ago

I think that is a good point create a utility function for this issue.

Moosjes commented 3 years ago

Thanks!

nicolasmeijer commented 3 years ago

Ok just saw this issue. Could be good to put it in the docs as well.

apenab commented 3 years ago

Ok just saw this issue. Could be good to put it in the docs as well.

I going to add this explanation in the Readme.md doc. Thanks for the suggestion!

sarkis1997 commented 1 year ago

Great job on the react-dymo- hooks! In the web sdk of dymo there is an option to print multiple labels in one job. This could be achieved by the LabelSetBuilder. How can I achieve the same, to build multiple labels in one job?

apenab commented 1 year ago

Great job on the react-dymo- hooks! In the web sdk of dymo there is an option to print multiple labels in one job. This could be achieved by the LabelSetBuilder. How can I achieve the same, to build multiple labels in one job?

Discussion about this topic here: https://github.com/apenab/react-dymo/discussions/33

sarkis1997 commented 1 year ago

Hi,I saw that you have implemented this function.Do you have an example of the string to pass for multiple prints?Regards,SarkisOp 23 okt. 2022 om 16:51 heeft Antonio Peña Batista @.***> het volgende geschreven: Closed #1 as completed via #35.

—Reply to this email directly, view it on GitHub, or unsubscribe.You are receiving this because you commented.Message ID: @.***>

apenab commented 1 year ago

Hi,I saw that you have implemented this function.Do you have an example of the string to pass for multiple prints?Regards,SarkisOp 23 okt. 2022 om 16:51 heeft Antonio Peña Batista @.> het volgende geschreven: Closed #1 as completed via #35. —Reply to this email directly, view it on GitHub, or unsubscribe.You are receiving this because you commented.Message ID: @.>

@sarkis1997 https://github.com/apenab/react-dymo/issues/34#issuecomment-1288156320