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

I cannot print the PDF file correctly in my project #438

Open
adilson181 opened this issue Mar 1, 2021 · 3 comments
Open

I cannot print the PDF file correctly in my project #438

adilson181 opened this issue Mar 1, 2021 · 3 comments

Comments

@adilson181
Copy link

Hello, I have a problem printing the PDF file in my project, it is printing with strange characters, could someone help me?

This is the result of how it is being printed:

1b4d20b2-4dc7-4572-b20d-669ab0e37cbe

I'm using this plugin to convert from base64 to ArrayBuffer base64-arraybuffer
Below is the code I am using:

print.service.ts:

import { decode } from 'base64-arraybuffer';

@Injectable({
  providedIn: 'root'
})
export class PrintService {

  constructor() { }

  base64ToArrayBuffer(base64) {
  //This convert string base64 to ArrayBuffer
    var converted= decode(base64);
    return converted;
  }

config.page.ts:

import { Component, OnInit } from '@angular/core';
import { PrintService } from 'src/app/services/print.service';

@Component({
  selector: 'app-config',
  templateUrl: './config.page.html',
  styleUrls: ['./config.page.scss'],
})
export class ConfigPage implements OnInit {

  bytesConverted:any;

constructor(private print:PrintService) { }

convertBase64(){
    const base64 = "data:application/pdf;base64,JVBERi0xLjMKMyAwIG9iago8PC9UeXBlIC9QYWdlCi9QYXJlbnQgMSAwIFIKL1Jlc291cmNlcyAyIDAgUgovQ29udGVudHMgNCAwIFI+PgplbmRvYmoKNCAwIG9iago8PC9GaWx0ZXIgL0ZsYXRlRGVjb2RlIC9MZW5ndGggNDA2Nj4+CnN0cmVhbQp4nI2bzXLbVhKF93mKu5hFUhVD+CUAVc2CkShHiSU6Eu3FVDa0RNucSKKHouOpvG4WqaznBaZxu2/3aTiQk1Qs8ZyDS/iyG/0Fgsrww1d51rThE33J8zw8/6qIX/HP/Tsyy44y363C0VkROpLD6m1YrL76T+Dj3gXyqi6r6lCXZVZWYXUbvp5fzsNZFv518v3VcvXjIlzMr1bnl+F6efV6sVpcn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E2IDAwMDAwIG4gCjAwMDAwMDU1OTIgMDAwMDAgbiAKdHJhaWxlcgo8PAovU2l6ZSAxMgovUm9vdCAxMSAwIFIKL0luZm8gMTAgMCBSCj4+CnN0YXJ0eHJlZgo1Njk2CiUlRU9GCg==";
    console.log("Initialize convert Base 64...");
    let bytes =  this.print.base64ToArrayBuffer(base64);
    console.log(bytes);
    this.bytesConverted = bytes;
  }

config.page.html:

<ion-button expand="full" color="primary" (click)="convertBase64()">
    Convert base64
  </ion-button>

  <ion-button expand="full" color="primary" (click)="printConverted()">
    Print Converted
  </ion-button>

This is the printer:

6aa7f96f-0e0a-4d50-9b25-cedfaf9e673f

@PauloMotaZetec
Copy link

Hi,
Can you print images? Does that printer allows it?
Probably you will have to convert the PDF to image, using ImageMagick.

@nicoguevara
Copy link

Hello, I have the same problem, were you able to solve it?

@Anne-TF
Copy link

Anne-TF commented Mar 21, 2023

Did someone find the solution? I'm struggling with this rn

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

No branches or pull requests

4 participants