SharePDF
using UnityEngine;
using Photon.Pun;
using Paroxe.PdfRenderer;
public class SharePDF : MonoBehaviour
{
public PhotonView photonView; public PDFViewer PDFViewer; public bool Presenter = false; public string UserPDFurl;
//////////////////////////////////////////////////////////////////////// Once presenter wants to share the link of PDF among all users
public void SharePDFURL()
{
if (Presenter == true)
{
photonView.RPC("RPC_SharePDFURL", RpcTarget.AllBuffered, UserPDFurl);
}
}
[PunRPC]
private void RPC_SharePDFURL(string PDFURL)
{
PDFViewer.FileURL = PDFURL;
PDFViewer.LoadDocumentFromWeb(PDFURL, "", 0);
}
//////////////////////////////////////////////////////////////////// Once presenter changed the page (It gets orders from PDFViewer script)
public void LoadPDFData()
{
photonView.RPC("RPC_PDFData", RpcTarget.AllBuffered, PDFViewer.currentpagenumber);
}
[PunRPC]
private void RPC_PDFData(int currentpagenumber)
{
if (Presenter == false)
{
PDFViewer.GoToPage(currentpagenumber);
}
}
/// ////////////////////////////////////////////////////////////// When the presenter zoom in or zoom out (It gets orders from PDFViewer script)
public void ZoomPDF(float zoomnumber, bool zoomin)
{
photonView.RPC("RPC_ZoomPDF", RpcTarget.AllBuffered, zoomnumber, zoomin);
}
[PunRPC]
private void RPC_ZoomPDF(float zoomnumber, bool zoomin)
{
if (Presenter == false)
{
PDFViewer.NetworkZoom(zoomnumber, zoomin);
}
}
}